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

fix: avoid ignoring on_complete if provided explicitly via transaction parameters #79

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

aorumbayev
Copy link
Contributor

@aorumbayev aorumbayev commented Apr 18, 2024

Proposed Changes

  • This was reported by @cusma. The main reason is potential confusion that can be caused by the fact that user has ability to specify on complete in transaction parameters, yet its ignored in some scenarios like opt_in (where it overwrites the oncomplete to use OptInOC).

For instance:

    app_client.opt_in( # this internally is actually going to ignore the on_compete from user and set it to OptInOC
        transaction_parameters=OnCompleteCallParameters(
            on_complete=OnComplete.DeleteApplicationOC
        ),
    )

As seen above, the usage may be confusing, we either want to limit ability to use OnCompleteCallParameters (currently its a sub class of transaction params hence why it works) or account to prioritize taking the on_complete from transaction params if present.

@robdmoore what's your opinion on this? The pr simply adds extra lines to prioritize taking the user's on_complete if it exists on transaction params object, otherwise default to dedicated on_complete param (which may or may not be pre-set by algokit typed client to specific on complete values).

Copy link

github-actions bot commented Apr 18, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit_utils
   _debugging.py140795%20, 41, 76, 80, 89, 129, 157
   _ensure_funded.py69199%99
   _transfer.py62395%13, 76–77
   account.py851385%14–17, 61–65, 96, 109, 136, 139, 183
   application_client.py5337786%59–60, 166, 171, 200, 312, 317–318, 320, 322, 787, 802, 820–823, 913, 953, 965, 978, 1020, 1080–1086, 1090–1095, 1097, 1133, 1140, 1253, 1283, 1297, 1342–1344, 1346, 1356–1413, 1424–1429, 1449–1452
   application_specification.py971189%92, 94, 193–202, 206
   asset.py79594%9, 27–30
   common.py13192%13
   config.py511865%38–39, 50, 55, 60, 64–69, 100–109
   deploy.py4592495%31–34, 169, 173–174, 191, 206, 247, 403, 414–422, 439–442, 452, 460, 653–654, 678
   dispenser_api.py821285%112–113, 117–120, 155–157, 176–178
   logic_error.py38295%6, 29
   models.py227697%45, 50–52, 61–62
   network_clients.py66395%89–90, 121
TOTAL201518391% 

Tests Skipped Failures Errors Time
194 0 💤 0 ❌ 0 🔥 2m 52s ⏱️

@aorumbayev aorumbayev requested a review from robdmoore April 18, 2024 16:43
@aorumbayev aorumbayev changed the title fix: avoid ignoring on complete if user provides one via transaction parameters fix: avoid ignoring on complete if provided explicitly via transaction parameters Apr 22, 2024
@aorumbayev aorumbayev changed the title fix: avoid ignoring on complete if provided explicitly via transaction parameters fix: avoid ignoring on_complete if provided explicitly via transaction parameters Apr 22, 2024
@aorumbayev aorumbayev marked this pull request as ready for review April 23, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants