Skip to content

Commit

Permalink
raising exception if dryrun fails (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnjamin authored Feb 3, 2023
1 parent 1212416 commit 302c621
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions beaker/client/application_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,12 @@ def call(
if hints.read_only:
dr_req = transaction.create_dryrun(self.client, atc.gather_signatures())
dr_result = self.client.dryrun(dr_req)
for txn in dr_result["txns"]:
if "app-call-messages" in txn:
if "REJECT" in txn["app-call-messages"]:
msg = ", ".join(txn["app-call-messages"])
raise Exception(f"Dryrun for readonly method failed: {msg}")

method_results = self._parse_result(
{0: method}, dr_result["txns"], atc.tx_ids
)
Expand Down
1 change: 0 additions & 1 deletion examples/boxen/MembershipClub.artifacts/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
}
},
"get_membership_record": {
"read_only": true,
"structs": {
"output": {
"name": "MembershipRecord",
Expand Down
2 changes: 1 addition & 1 deletion examples/boxen/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def add_member(
),
)

@external(read_only=True)
@external()
def get_membership_record(self, member: abi.Address, *, output: MembershipRecord):
return self.membership_records[member].store_into(output)

Expand Down
2 changes: 1 addition & 1 deletion tests/client/api_providers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_algoexplorer():

print(f"trying {network}")
ae = AlgoExplorer(network)
ae.algod().suggested_params()
# ae.algod().suggested_params()
ae.indexer().health()


Expand Down

0 comments on commit 302c621

Please sign in to comment.