Apps: txn.Access list for access to more resources#6286
Apps: txn.Access list for access to more resources#6286jannotti merged 45 commits intoalgorand:masterfrom
Conversation
|
This shouldn't need a new AVM version, correct? Since AVM9 we've had group resource sharing, which means an app has no way of knowing what resources are available. Although I suppose it could check if it's an outer call and check the rest of the group, but seems highly improbable to account for all the sharing rules even if an app wanted to do that. |
|
I think you're asking "will only new programs, AVM v12, be able to use this?" I think it should be ok to let old programs use this, including letting these resources be accessed by other programs in the same group that are a low version. I'm pretty sure we made the same decision with resource pooling. After the consensus upgrade, programs suddenly got access to things they didn't "know" they had access to by looking into the arrays. I'll have to confirm whether we put in any limitations. For example, I think it would be unsafe to let v3 (!) programs see extra ASAs. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6286 +/- ##
==========================================
+ Coverage 49.81% 50.64% +0.82%
==========================================
Files 356 656 +300
Lines 64417 111052 +46635
==========================================
+ Hits 32091 56240 +24149
- Misses 30970 51941 +20971
- Partials 1356 2871 +1515 ☔ View full report in Codecov by Sentry. |
|
Right that's what I would think as well. The main reason I ask is because if we don't require a specific AVM version existing applications, even if immutable, can leverage this feature by simply updating their client-side code. |
This commit ensures that assets are made available properly with tx.Access
Having worked on it some more: Yes, any transaction can use As for sharing, we only enabled sharing for v9 programs and higher, so I made that true here as well. Your v9 or higher programs will be able to see the resources made available from other transactions, whether those transactions made the resources available with the "old-style" foreign arrays or with Like |
98e1981 to
1573e6b
Compare
algorandskiy
left a comment
There was a problem hiding this comment.
- Left some comments
- Empty box ref in Access gaining extra reads budged should be somehow better documented
Check out this beauty, co-authored by chatgpt.
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a unified Access field for app calls to replace the multiple resource reference arrays (accounts, assets, apps, boxes) with a single list that can support up to 16-32 resources instead of the current 8-resource limit.
Key changes:
- Adds new
Accessfield toApplicationCallTxnFieldscontainingResourceRefentries - Updates
goalto support--accessflag for creating transactions with the new format - Implements fallback to legacy foreign arrays when
Accessis not used - Updates error messages to use "unavailable" instead of "invalid" for consistency
Reviewed Changes
Copilot reviewed 55 out of 56 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| util/fn.go | Adds functional programming utilities Map and MapErr for slice transformations |
| test/scripts/e2e_subs/tealprogs/xappreads.teal | Updates TEAL version and simplifies logic using assertions |
| test/scripts/e2e_subs/tealprogs/assets-escrow9.teal | New TEAL v9 program demonstrating access-aware asset operations |
| test/scripts/e2e_subs/shared-resources.py | Updates error message expectation |
| test/scripts/e2e_subs/e2e-app-x-app-reads.sh | Adds tests for --access flag functionality |
| test/scripts/e2e_subs/e2e-app-simulate.sh | Updates error message and box size for new quota |
| test/scripts/e2e_subs/app-assets.sh | Improves test reliability with proper error handling |
| test/scripts/e2e_subs/app-assets-access.sh | New comprehensive test suite for --access functionality |
| multiple test files | Updates API calls to use new RefBundle parameter structure |
| libgoal/transactions.go | Implements RefBundle type and access list attachment logic |
| libgoal/libgoal_test.go | Adds comprehensive tests for foreign reference and access resolution |
| data/transactions/logic/resources.go | Updates resource management for access lists and error messages |
| ledger/apply/application.go | Updates program checking to handle access lists |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
Today, app developers find it frustrating that they can only list 8 resources in a transaction. This number is artificially low because there are rules that allow access to many more than 8 items when, for example, 4 account and 4 apps are listed.
This PR introduced a single unified
Accessfield on app calls, which contains all accounts, apps, asas, and boxes that the transaction can touch. Because no extra rules allow access to extra resources, we can expand the allowable size of such a list. 32 seems likely. (edit: currently thinking 16, but also upping the box quota per reference to 2k)This will probably increase performance, since it will now be reasonable to perform perfect prefetching of all resources an app call might touch.
This PR also augments
goalto create these transactions if the--accessflag is used. It still needs e2e_subs tests that exercise it. changing back to draft until I write thoseThis PR does not actually implement the improved pre-fetching. Should it?
Test Plan