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

Graviton 4 abi router #634

Merged
merged 268 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
268 commits
Select commit Hold shift + click to select a range
2c2b7b2
Merge branch 'master' into avm8
ahangsu Aug 15, 2022
61af648
Merge branch 'master' into avm8
ahangsu Aug 31, 2022
5282726
Merge branch 'master' into avm8
ahangsu Sep 15, 2022
76010b2
Changes to avm8 docs (#546)
jasonpaulos Sep 29, 2022
d767c66
Merge branch 'master' into avm8
ahangsu Oct 25, 2022
cc49a55
Support new AVM 8 account parameters (#555)
jdtzmn Oct 26, 2022
1d7cd6a
add frame ops to avm8 branch
ahangsu Oct 26, 2022
49d169e
specify FRAME_POINTER_VERSION in frame-op branch
ahangsu Oct 26, 2022
02f3775
just the work of abi data schema
ahangsu Oct 26, 2022
e8c5d2c
squashed
ahangsu Oct 19, 2022
a044f80
change in round trip test, stop something blocking me
ahangsu Oct 19, 2022
6739c00
update frame dig and proto use
ahangsu Oct 19, 2022
ce9aec8
fix var n loaded
ahangsu Oct 19, 2022
620c61e
documentation
ahangsu Oct 26, 2022
87d97b1
narrower name, module name
ahangsu Oct 27, 2022
80a40d8
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Oct 27, 2022
208be80
reformat evaluator code, less indentation
ahangsu Oct 27, 2022
d3fd16d
minor, found a bug on output setting in subroutine in frame pointer c…
ahangsu Oct 27, 2022
2b4bb17
one small step in testing, a big step for frame pointer!
ahangsu Oct 27, 2022
411f007
work in black box testing
ahangsu Oct 28, 2022
a70c125
0xBAD hack, need to revisit for ugly pass by for type system
ahangsu Oct 28, 2022
1e12ca0
move spot reserving in proto
ahangsu Oct 28, 2022
a5cd38a
reformat code a bit on black box example part
ahangsu Oct 31, 2022
7db5dfa
start changing abi roundtrip tesal file name
ahangsu Oct 31, 2022
e1dbcd7
roundtrip test
ahangsu Oct 31, 2022
ac98d94
comments
ahangsu Oct 31, 2022
cf0c331
still wristing with docker, revert space reserving stuffs
ahangsu Oct 31, 2022
769419b
minor, pure compilation more flexible
ahangsu Oct 31, 2022
d77b442
roundtrip dryrun flexibility
ahangsu Oct 31, 2022
20c0ef8
conditional factorial done, need int65 and complex130
ahangsu Oct 31, 2022
d056f4a
gravition abi test pytest mark parameterized
ahangsu Nov 1, 2022
6ba772a
module
ahangsu Nov 1, 2022
5840a8b
per review comments
ahangsu Nov 1, 2022
a596fc1
per review comments
ahangsu Nov 2, 2022
519c752
per review comments, depth -> frame_depth
ahangsu Nov 2, 2022
d0533f5
Merge branch 'frame-ops' into abi-value-data-schema
ahangsu Nov 2, 2022
48d0678
per review comments, on final type annotation
ahangsu Nov 2, 2022
7d4277b
per review comments, renaem to AbstractVar/FrameVar
ahangsu Nov 2, 2022
d93207d
per review comments, move storage model to AbstractVar, rough hack to…
ahangsu Nov 2, 2022
71ad8a6
better type checking in scratch slot
ahangsu Nov 2, 2022
921bf85
reformat imports and class decl for FrameVar and ScratchVar
ahangsu Nov 2, 2022
1012d4d
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
304f273
still thinking about hiding the _stored value
ahangsu Nov 2, 2022
7f019cd
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
4b688df
proto renaming stuffs
ahangsu Nov 2, 2022
0f5c916
per pr comment, rename to FrameVar
ahangsu Nov 2, 2022
37ee4cd
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
0924d94
take bury out
ahangsu Nov 2, 2022
c3acbb9
Merge branch 'frame-ops' into abi-value-data-schema
ahangsu Nov 2, 2022
81c2368
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
d1c52a2
pop popn
ahangsu Nov 2, 2022
52f24a4
Merge branch 'frame-ops' into abi-value-data-schema
ahangsu Nov 2, 2022
3277c51
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
d457f99
abstractvar.py
ahangsu Nov 2, 2022
1fa70d9
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
95bc48a
unexport FrameVar and AbstractVar
ahangsu Nov 2, 2022
972a259
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
8c41726
unexport use of frame ops
ahangsu Nov 2, 2022
01a04dd
Merge branch 'frame-ops' into abi-value-data-schema
ahangsu Nov 2, 2022
88da04f
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
075710e
rename to num allocs
ahangsu Nov 2, 2022
61551b8
remove _set_data_storage
ahangsu Nov 2, 2022
0a3b7b0
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
8855002
namedtuple set var method
ahangsu Nov 2, 2022
8eca96d
rename from stack_depth to frame_index
ahangsu Nov 2, 2022
debe17a
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
c241cfa
CHANGELOG.md
ahangsu Nov 2, 2022
dd687c7
Frame Ops to `avm8` branch PR (#585)
ahangsu Nov 2, 2022
6ae67e6
add frame ops to avm8 branch
ahangsu Oct 26, 2022
917229a
specify FRAME_POINTER_VERSION in frame-op branch
ahangsu Oct 26, 2022
892dd50
just the work of abi data schema
ahangsu Oct 26, 2022
5ec4124
narrower name, module name
ahangsu Oct 27, 2022
7b60233
per review comments, on final type annotation
ahangsu Nov 2, 2022
2055ce6
per review comments, renaem to AbstractVar/FrameVar
ahangsu Nov 2, 2022
f689937
per review comments, move storage model to AbstractVar, rough hack to…
ahangsu Nov 2, 2022
f362b57
better type checking in scratch slot
ahangsu Nov 2, 2022
a0f1a81
reformat imports and class decl for FrameVar and ScratchVar
ahangsu Nov 2, 2022
46b886b
still thinking about hiding the _stored value
ahangsu Nov 2, 2022
0d5eaf3
per pr comment, rename to FrameVar
ahangsu Nov 2, 2022
d02d73b
take bury out
ahangsu Nov 2, 2022
25a98a4
abstractvar.py
ahangsu Nov 2, 2022
2704c5a
unexport FrameVar and AbstractVar
ahangsu Nov 2, 2022
92c46f0
unexport use of frame ops
ahangsu Nov 2, 2022
5e256f8
remove _set_data_storage
ahangsu Nov 2, 2022
296f6cf
rename from stack_depth to frame_index
ahangsu Nov 2, 2022
bca1868
hide FRAME_POINTER_VERISON
ahangsu Nov 2, 2022
224bc9c
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 2, 2022
40ebb8c
hide FRAME_POINTER_VERISON
ahangsu Nov 2, 2022
a1770c4
Validate types option (#590)
tzaffi Nov 3, 2022
5193635
wrong import, blame my lsp
ahangsu Nov 3, 2022
2a57388
FrameVar error msg fix
ahangsu Nov 3, 2022
bb6ad15
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 3, 2022
00defe6
Merge branch 'master' into abi-value-data-schema
ahangsu Nov 3, 2022
a895cb9
scrape down the change of frame pointer from feature/fp-subroutine
ahangsu Nov 3, 2022
195dc76
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 3, 2022
630e046
Memory layout for frame var and frame ops (#593)
ahangsu Nov 7, 2022
e399e09
rename arg for mem layout, on return alloc number
ahangsu Nov 7, 2022
0a5b570
if there's nothing to initialize for local...
ahangsu Nov 7, 2022
8d97fa6
Merge branch 'feature/fp-subroutine' into feature/fp-subroutine-merge
ahangsu Nov 7, 2022
b8b6f32
update changes from mem layout
ahangsu Nov 7, 2022
29f186c
Merge branch 'master' into abi-value-data-schema
ahangsu Nov 8, 2022
596d6ac
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 8, 2022
f6994ae
minor change in type-check in computed-type
ahangsu Nov 8, 2022
de32b9a
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 8, 2022
21e9350
minor change in type-check in computed-type
ahangsu Nov 8, 2022
db2a00a
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 8, 2022
b0045ec
linewidth
ahangsu Nov 8, 2022
877e109
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 8, 2022
9daee52
some minor comments
ahangsu Nov 8, 2022
14275df
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 8, 2022
6ef76dd
revert to framevar version
ahangsu Nov 8, 2022
19a1fe2
use deferred only on scratch slot
ahangsu Nov 8, 2022
431026b
use deferred only on scratch slot, comments
ahangsu Nov 8, 2022
66a6416
spellings
ahangsu Nov 10, 2022
3bd25fa
remove unused class methods
ahangsu Nov 10, 2022
39f6f6b
remove scratchvar type check in var_n_load
ahangsu Nov 10, 2022
bb8f9e5
docstring explanation of validate type
ahangsu Nov 10, 2022
411c570
docstring
ahangsu Nov 10, 2022
14cc5ee
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 10, 2022
daf877d
docstring
ahangsu Nov 10, 2022
d8b5eb6
collect changes to basis pr
ahangsu Nov 10, 2022
c1d6dfb
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 10, 2022
935cc0c
wording check
ahangsu Nov 10, 2022
fe3b60d
good find on one more dupped stuff
ahangsu Nov 13, 2022
b80e1ae
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 13, 2022
55a838a
per Zeph's PR comments
ahangsu Nov 14, 2022
f1de3ec
no overshadowing version param
ahangsu Nov 14, 2022
370e3f5
Merge branch 'master' into abi-value-data-schema
ahangsu Nov 14, 2022
099836c
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 14, 2022
5cf0cf5
type_of subroutinecall
ahangsu Nov 14, 2022
4ac41b9
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 14, 2022
29be7ff
type_of subroutinecall
ahangsu Nov 14, 2022
ca4d75d
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 14, 2022
cd7d52c
remove all validate_type
ahangsu Nov 14, 2022
35cf94c
Merge branch 'abi-value-data-schema' into feature/fp-subroutine
ahangsu Nov 14, 2022
a70eb3d
Merge branch 'master' into feature/fp-subroutine
ahangsu Nov 14, 2022
dcb90dc
Test identical functionality across versions - just a POC and too slo…
Nov 15, 2022
f3476c5
bad alias
Nov 15, 2022
c9d9aa2
handle logic sigs and trace compiled teal in the pt dr executor
Nov 15, 2022
34ec871
port identity predicates to graviton_test.py
Nov 15, 2022
2d2666c
some examples failing. Might be a red herring, or might be related to…
Nov 15, 2022
b7d77a2
fixing wrong stack mechanism for dynamic scratch var
ahangsu Nov 15, 2022
273d304
fixing wrong stack mechanism for dynamic scratch var
ahangsu Nov 15, 2022
b681c24
Merge branch 'feature/fp-subroutine' into graviton-identical-subroutines
ahangsu Nov 15, 2022
a55052d
rename
ahangsu Nov 16, 2022
b24cbb8
Merge branch 'feature/fp-subroutine' into graviton-identical-subroutines
ahangsu Nov 16, 2022
29cd589
special case notes
ahangsu Nov 16, 2022
e586564
fix embarassing spelling
Nov 16, 2022
77ca4a5
remove run-once forever to be skipped slow test
Nov 23, 2022
f5ef819
Test identical functionality across versions - just a POC and too slo…
Nov 15, 2022
7cddccd
bad alias
Nov 15, 2022
08a51f2
handle logic sigs and trace compiled teal in the pt dr executor
Nov 15, 2022
8a84f73
port identity predicates to graviton_test.py
Nov 15, 2022
61d1cc6
some examples failing. Might be a red herring, or might be related to…
Nov 15, 2022
6922ac1
special case notes
ahangsu Nov 16, 2022
6417265
fix embarassing spelling
Nov 16, 2022
b4d9300
remove run-once forever to be skipped slow test
Nov 23, 2022
72a7490
update test comment
ahangsu Dec 3, 2022
849b892
Merge remote-tracking branch 'origin' into graviton-identical-subrout…
Dec 6, 2022
9df2c7b
revert - except for better local function name
Dec 6, 2022
149f864
Merge remote-tracking branch 'refs/remotes/origin/graviton-identical-…
Dec 6, 2022
4451f3d
Apply suggestions from code review
tzaffi Dec 6, 2022
2f7a7ac
black
Dec 6, 2022
f9aebde
unused var
Dec 6, 2022
4d45f09
Update requirements.txt
tzaffi Dec 14, 2022
5b4ae33
Prove no assertions tested
michaeldiamant Dec 22, 2022
669b202
Merge branch 'master' into graviton-identical-subroutines
Dec 22, 2022
2dc41da
Merge branch 'broken_invariants' into graviton-identical-subroutines
Dec 22, 2022
3b20a21
get the tests to actually run, and nudge invariants to pass both with…
Dec 23, 2022
6e7889d
absorb the new graviton API
Dec 24, 2022
cf9ced7
Merge branch 'master' into graviton-identical-subroutines
Dec 24, 2022
d8bd2db
update graviton's pin to latest branch commit
Dec 26, 2022
4790069
Refactor graviton usage
Dec 31, 2022
7617c7a
new PyTealDryRunExecutor.executor() method
Jan 1, 2023
5f88771
pass txn_params and verbose to graviton's runners
Jan 1, 2023
97aff37
pass txn_params and verbose to graviton's runners
Jan 1, 2023
1f97e30
don't re-instantiate the executor at every iteration
Jan 1, 2023
315fc23
remove now unused add_trace()
Jan 1, 2023
09261e8
lint
Jan 1, 2023
18150bc
Update to requirements.txt to latest graviton commit
tzaffi Jan 1, 2023
69519c5
pin to graviton 0.7.0
Jan 3, 2023
3ad2f2e
fix gravition pin
Jan 3, 2023
0ee255c
pin to v0.7.0
tzaffi Jan 3, 2023
ed1baf4
Typo fix in docs (#625)
lvorithm Dec 28, 2022
251f0af
Merge branch 'graviton-identical-subroutines' into graviton-refac
tzaffi Jan 4, 2023
1f62233
Merge branch 'master' into graviton-refac
Jan 13, 2023
fc06c17
flake8
Jan 13, 2023
3232a09
🤞
Jan 13, 2023
d0331b0
Trigger a build against head of depending graviton branch
tzaffi Jan 17, 2023
75cee1a
Merge branch 'feature/fp-router' into graviton-4-abi-router
Jan 17, 2023
df63e8c
move the router part of the compile_test to new abi_router_test.py, a…
Jan 17, 2023
6d0fb42
lint
Jan 17, 2023
28687e5
pin to appropriate graviton
Jan 19, 2023
e17272e
adding to router's API: BareCallActions.get_method_config() + Router.…
Jan 19, 2023
6a5d9a0
TDD 2/3 done
Jan 19, 2023
8445c53
RouterSimulation - code complete
Jan 19, 2023
8915b9f
save the work
Jan 19, 2023
139b26b
positive cases
Jan 19, 2023
34f6116
lint
Jan 19, 2023
7053df5
Merge branch 'feature/fp-router' into graviton-4-abi-router
Jan 19, 2023
c9e88d8
wip
Jan 19, 2023
fb7e5fc
Merge branch 'feature/fp-router' into merge-fp-router-to-graviton-4-r…
ahangsu Jan 23, 2023
c9a960b
minor changes
ahangsu Jan 23, 2023
df3eca8
Merge pull request #644 from algorand/merge-fp-router-to-graviton-4-r…
tzaffi Jan 23, 2023
b25ec2e
Merge branch 'feature/fp-router' into graviton-4-abi-router
ahangsu Jan 23, 2023
d017bc6
Merge branch 'feature/fp-router' into graviton-4-abi-router
ahangsu Jan 24, 2023
78ebc1f
Merge branch 'feature/fp-router' into graviton-4-abi-router
ahangsu Jan 26, 2023
2afd5d9
Merge pull request #652 from algorand/conflict-resolving-router-graviton
tzaffi Jan 26, 2023
e577bf3
test_router_build_idempotence
Jan 20, 2023
d4c16de
wip
Jan 20, 2023
98c340f
tweak against local unmerged changes
Jan 26, 2023
1e8ce99
small tweaks- main one is initializing `self.bare_calls`
Jan 26, 2023
322c2d8
small refactoring around Router's `bare_call_actions`
Jan 26, 2023
e980f02
Merge branch 'feature/fp-router' into graviton-4-abi-router
Feb 2, 2023
e893a20
mergin
Feb 2, 2023
5f6b798
lint
Feb 2, 2023
2dafd52
Merge branch 'feature/fp-router' into graviton-4-abi-router
Feb 2, 2023
6090339
unit test for BareCallActions.get_method_config
Feb 3, 2023
826b0b0
Clean up simulate_and_assert in preperation for negative cases
Feb 3, 2023
5d37e39
back to square 2
Feb 4, 2023
ed6ca73
better stats
Feb 4, 2023
da8672a
passing positive with clear program
Feb 5, 2023
a33f1de
full validation coverage
Feb 5, 2023
6ffe14b
cleanup
Feb 5, 2023
628d49f
lint
Feb 5, 2023
c11b115
tests seem to be failing for graviton, but here?
Feb 6, 2023
8199af3
report go-algrand commit hash when starting algod
Feb 6, 2023
6a553e8
remove unused flakey fixtures + fix expected dry run error message
Feb 6, 2023
2fbedc2
another to comment out
Feb 6, 2023
1ca8944
fix wrong make ref
Feb 6, 2023
5004dd9
Update Makefile
tzaffi Feb 6, 2023
e583762
Apply suggestions from code review
tzaffi Feb 6, 2023
185f107
Update requirements.txt
tzaffi Feb 6, 2023
ed1b081
Update requirements.txt
tzaffi Feb 6, 2023
869fb85
non-trivial clear program
Feb 7, 2023
33b8c2b
lint and rename variable
Feb 7, 2023
835d37e
the_same and the_same bug
Feb 7, 2023
d881a14
Update pyteal/ast/router.py
tzaffi Feb 7, 2023
5dd9b8e
Update pyteal/compiler/compiler_test.py
tzaffi Feb 7, 2023
87f281e
per CR suggstion - better non_triv clear program expression
Feb 7, 2023
da6c2de
per CR suggestion: method configs should be keyed of signature not na…
Feb 7, 2023
5b98699
per CR suggestions
Feb 7, 2023
98c6d5e
per CR suggestions
Feb 7, 2023
2e8e06f
per CR suggestions
Feb 7, 2023
510dde8
Update tests/blackbox.py
tzaffi Feb 8, 2023
deca0ac
per CR suggestion: tighten up local functions and closure declarations
Feb 8, 2023
ac8ad40
Apply suggestions from code review
tzaffi Feb 8, 2023
122879b
Update tests/integration/abi_router_test.py
tzaffi Feb 8, 2023
7dcb5c0
Update tests/integration/abi_router_test.py
tzaffi Feb 8, 2023
89abe75
per CR suggestions
Feb 8, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
echo $installed
[[ $installed =~ "Python ${expected}" ]] && echo "Configured Python" || (echo "Failed to configure Python" && exit 1)
- name: Start algod
run: make algod-start
run: make algod-start-report
- name: Install python dependencies
run: make setup-development
- name: Integration Tests Only
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ lint-and-test: check-generate-init lint test-unit
algod-start:
docker compose up -d algod --wait

algod-version:
docker compose exec algod goal --version

algod-start-report: algod-start algod-version

algod-stop:
docker compose stop algod

integration-run:
pytest -n $(NUM_PROCS) --durations=10 -sv tests/integration -m "not serial"
pytest --durations=10 -sv tests/integration -m serial
Expand Down
17 changes: 16 additions & 1 deletion pyteal/ast/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ def approval_construction(self) -> Optional[Expr]:
)
return Cond(*[[n.condition, n.branch] for n in conditions_n_branches])

def get_method_config(self) -> MethodConfig:
return MethodConfig(
no_op=self.no_op.call_config,
opt_in=self.opt_in.call_config,
close_out=self.close_out.call_config,
update_application=self.update_application.call_config,
delete_application=self.delete_application.call_config,
)


BareCallActions.__module__ = "pyteal"

Expand Down Expand Up @@ -806,6 +815,10 @@ def __init__(

self.bare_call_actions: BareCallActions = bare_calls or BareCallActions()

self.method_configs: dict[str | None, MethodConfig] = dict()
if not self.bare_call_actions.is_empty():
self.method_configs[None] = self.bare_call_actions.get_method_config()

def _clean(self) -> None:
self.approval_ast._clean_bare_calls()

Expand All @@ -831,9 +844,10 @@ def add_method_handler(
"""
if not isinstance(method_call, ABIReturnSubroutine):
raise TealInputError(
"for adding method handler, must be ABIReturnSubroutine"
"for adding method handler, must be ABIReturnSubroutine but method_call is {type(method_call)}"
tzaffi marked this conversation as resolved.
Show resolved Hide resolved
)
method_signature = method_call.method_signature(overriding_name)
final_name = overriding_name or method_call.name()
ahangsu marked this conversation as resolved.
Show resolved Hide resolved
if method_config is None:
method_config = MethodConfig(no_op=CallConfig.CALL)
if method_config.is_never():
Expand Down Expand Up @@ -862,6 +876,7 @@ def add_method_handler(
self.approval_ast.add_method_to_ast(
method_signature, method_approval_cond, method_call
)
self.method_configs[final_name] = method_config
return method_call

def method(
Expand Down
31 changes: 30 additions & 1 deletion pyteal/ast/router_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def test_bare_call_config_clear_state_failure():
assert "Attempt to construct clear state program from bare app call" in str(tie)


def test_bare_call_actions_asdict():
def test_BareCallActions_asdict():
no_action = pt.OnCompleteAction()
del_action = pt.OnCompleteAction(action=pt.Int(1), call_config=pt.CallConfig.ALL)
close_action = pt.OnCompleteAction(action=pt.Int(2), call_config=pt.CallConfig.CALL)
Expand Down Expand Up @@ -409,6 +409,35 @@ def test_bare_call_actions_asdict():
}


def test_BareCallActions_get_method_config():
from pyteal.ast.router import MethodConfig, CallConfig

cc_all, cc_call, cc_create = (
pt.CallConfig.ALL,
pt.CallConfig.CALL,
pt.CallConfig.CREATE,
)
optin_action = pt.OnCompleteAction(action=pt.Int(1), call_config=cc_all)
noop_action = pt.OnCompleteAction(action=pt.Int(2), call_config=cc_call)
update_action = pt.OnCompleteAction(action=pt.Int(3), call_config=cc_create)

bca = pt.BareCallActions(
update_application=update_action,
opt_in=optin_action,
no_op=noop_action,
)

mc = bca.get_method_config()
assert mc == MethodConfig(
close_out=CallConfig.NEVER,
delete_application=CallConfig.NEVER,
no_op=cc_call,
opt_in=cc_all,
update_application=cc_create,
clear_state=CallConfig.NEVER,
)


def test_router_register_method_clear_state_failure():
router = pt.Router("doomedToFail")

Expand Down
Loading