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

C2C Feature and Testing #268

Merged
merged 121 commits into from
Feb 9, 2022
Merged

C2C Feature and Testing #268

merged 121 commits into from
Feb 9, 2022

Conversation

tzaffi
Copy link
Contributor

@tzaffi tzaffi commented Dec 23, 2021

Handling Contract to Contract Applications in the SDK

This PR aims to show that the critical capabilities for handling C2C functionality are in place. This is accomplished by implementing and passing Cucumber integration tests that are defined in algorand-sdk-testing PR #156.

New Functionality

Slight Enhancement to Function Obtaining Application Account Address

In a Contract-to-Contract call, the application that is making the call is responsible for paying the associated transaction fees. This means that the application needs to be funded and that its account address should be readily available for funding. logic already contains get_application_address(), and I'm just adding a type-checker for it.

Add void ABI Method appl Transactions into the List[ABIResult] Member of AtomicTransactionResponse

This is mainly for completeness when trying to understand all trasactions (including nested) and all side-effects that resulted from ABI method calls in an atomic transactions group.

New Cucumber Tests

To pass the tests in testing's PR #156 (and mainly integration/c2s.feature) functions have been refactored with new steps added inside of test/steps/

Transaction call trace from an Atomic Transaction Composer ABI Execution

Allow json-like traces of ABI calls via transactions_trace(atc: AtomicTransactionComposer, results: List[ABIResult]) in v2_steps.py

Summary of changes

  • Makefile: re-org the cucumber tags into variables for easier running of selected tests
  • algosdk/atomic_transaction_composer.py: adding non-void ABI method appl transactions to the ABIResults inside of an AtomicTransactionResponse
  • algosdk/future/template.py: deprecation comments added
  • algosdk/logic.py: type assertion for get_application_address(appID: int)
  • algosdk/v2client/algod.py: re-org'ed the imports ONLY
  • requirements.txt: added glom and pyteset which are needed for testing (but not any running code)
  • run_integration.sh: temporarily pointing to C2C sdk-testing branch
  • test/environment.py: small bugfix
  • new file test/steps/__init__.py: helped me run my tests locally in a debugger
  • test/steps/steps.py: remove Templates related steps
  • test/steps/v2_steps.py: modifications for passing the cucumber tests
  • test_unit.py:
    • introduced a new test case in a pre-existing test
    • removed Templates related unit tests

Links

test/steps/v2_steps.py Outdated Show resolved Hide resolved
@@ -1,27 +1,31 @@
# py-algorand-sdk
Copy link
Contributor Author

Choose a reason for hiding this comment

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

markdownlint'ing this file

Copy link
Contributor

@jasonpaulos jasonpaulos left a comment

Choose a reason for hiding this comment

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

Pending algorand/algorand-sdk-testing#156, looks good

local_bytes=None,
local_ints=None,
extra_pages=None,
force_unique_transactions=False,
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this refactoring

test/steps/v2_steps.py Show resolved Hide resolved
@tzaffi tzaffi linked an issue Jan 24, 2022 that may be closed by this pull request
README.md Outdated Show resolved Hide resolved
a -> an and trigger new tests!
algosdk/future/template.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Template Feature Related Cucumber Tests C2C feature testing and implementation
3 participants