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

Ignore no op asset transfers. #1324

Merged
merged 5 commits into from
Nov 10, 2022

Conversation

winder
Copy link
Contributor

@winder winder commented Nov 9, 2022

Summary

If an asset transfer moves no assets, and is not an optin or closeout transaction, do not prefetch its resources.

Test Plan

CI and manual testing.

@codecov
Copy link

codecov bot commented Nov 9, 2022

Codecov Report

❗ No coverage uploaded for pull request base (release/2.15.0@103907b). Click here to learn what that means.
The diff coverage is n/a.

@@                Coverage Diff                @@
##             release/2.15.0    #1324   +/-   ##
=================================================
  Coverage                  ?   62.33%           
=================================================
  Files                     ?       52           
  Lines                     ?     8857           
  Branches                  ?        0           
=================================================
  Hits                      ?     5521           
  Misses                    ?     2832           
  Partials                  ?      504           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@michaeldiamant michaeldiamant left a comment

Choose a reason for hiding this comment

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

@winder PR matches my understanding for a tactical fix. Given that a more principled change is already underway, a quick fix seems reasonable to me.

Prefer 1+ approvals from folks more familiar with go-algorand ledger to vouch that the change is sensible.

@@ -22,7 +22,12 @@ func addToCreatorsRequest(stxnad *transactions.SignedTxnWithAD, assetsReq map[ba
}
case protocol.AssetTransferTx:
fields := &txn.AssetTransferTxnFields
if fields.XferAsset != 0 {

noOpXfer := (fields.AssetAmount == 0) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

the condition should be: not clawback (ct.AssetSender is empty), not AssetCloseTo, zero amount, sender != receiver to match apply/asset.go logic.
So I guess this needs && !fields.AssetSender.IsZero()

Copy link
Contributor

Choose a reason for hiding this comment

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

Right - since we certainly grabbed the asset to check the clawback addr, even if the movement is 0 amount (I check, as I suppose we don't have to check a 0 clawback)

@@ -22,7 +22,12 @@ func addToCreatorsRequest(stxnad *transactions.SignedTxnWithAD, assetsReq map[ba
}
case protocol.AssetTransferTx:
fields := &txn.AssetTransferTxnFields
if fields.XferAsset != 0 {

noOpXfer := (fields.AssetAmount == 0) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Right - since we certainly grabbed the asset to check the clawback addr, even if the movement is 0 amount (I check, as I suppose we don't have to check a 0 clawback)

@winder winder requested a review from algorandskiy November 9, 2022 19:40
Copy link
Contributor

@jannotti jannotti left a comment

Choose a reason for hiding this comment

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

Seems good

Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

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

Do we need to add a test?

@winder winder marked this pull request as ready for review November 10, 2022 15:27
@winder winder added the Bug-Fix label Nov 10, 2022
@winder winder merged commit 896a415 into algorand:release/2.15.0 Nov 10, 2022
@winder winder deleted the will/asset-app-optin branch November 10, 2022 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants