-
Notifications
You must be signed in to change notification settings - Fork 486
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
AVM: Allow immutable access to foreign app accounts #3994
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The different flag is a needed change. And testing before and after seems important, but doesn't have to be done using testConsensusRange
(but you'll thank me, it's easier)
Could you also update the Resource availability section in |
Codecov Report
@@ Coverage Diff @@
## master #3994 +/- ##
==========================================
- Coverage 54.49% 54.43% -0.07%
==========================================
Files 390 390
Lines 48500 48504 +4
==========================================
- Hits 26430 26402 -28
- Misses 19843 19876 +33
+ Partials 2227 2226 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the typo in the spec really needs to change, and that's trivial.
The others are a little paranoia, and tidying.
Looks good, I like the attempt to actually use the account in an inner pay.
data/transactions/logic/README_in.md
Outdated
@@ -180,6 +180,9 @@ _available_. | |||
associated account of a contract that was created earlier in the | |||
group is _available_. | |||
|
|||
* Since v7, the account associated with any contract present in the | |||
`txn.ForeignApplications` is _available_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`txn.ForeignApplications` is _available_. | |
`txn.ForeignApplications` field is _available_. |
tx.ForeignApps = []basics.AppIndex{basics.AppIndex(2)} | ||
|
||
// This app looks itself up in the ledger, so we need to put it in there. | ||
ledger.NewApp(tx.Sender, 2, basics.AppParams{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change this 2
to a higher number? I'm just being a little paranoid because I want it to be obvious that the 2 is the appID of the app, and not a slot number in ForeignApps.
Also I think that comment is a cut-n-paste. The app isn't looking itself up. The app being tested looks up this app.
ledger/internal/apptxn_test.go
Outdated
dl.beginBlock() | ||
dl.txgroup("", &appA, &appB) | ||
vb := dl.endBlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dl.beginBlock() | |
dl.txgroup("", &appA, &appB) | |
vb := dl.endBlock() | |
vb := dl.fullBlock(&appA, &appB) |
unless they actually need to be in a txgroup, rather than just run sequentially.
ledger/internal/apptxn_test.go
Outdated
} | ||
fund0 := fund1 | ||
fund0.Receiver = index0.Address() | ||
fund1.Receiver = index1.Address() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to rewriting the same value, as fund1
hasn't changed, right?
ledger/internal/apptxn_test.go
Outdated
} | ||
fund0 := fund1 | ||
fund0.Receiver = index0.Address() | ||
fund1.Receiver = index1.Address() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
ledger/internal/apptxn_test.go
Outdated
dl.beginBlock() | ||
dl.txgroup("", &fund0, &fund1, &callA, &callB) | ||
vb = dl.endBlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dl.beginBlock() | |
dl.txgroup("", &fund0, &fund1, &callA, &callB) | |
vb = dl.endBlock() | |
vb = dl.fullBlock(&fund0, &fund1, &callA, &callB)) |
unless they actually need to be in a txgroup, rather than just run sequentially.
ledger/internal/apptxn_test.go
Outdated
dl.beginBlock() | ||
dl.txgroup("", &appA, &appB) | ||
vb := dl.endBlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dl.beginBlock() | |
dl.txgroup("", &appA, &appB) | |
vb := dl.endBlock() | |
vb := dl.fullBlock(&appA, &appB) |
unless they actually need to be in a txgroup, rather than just run sequentially.
ledger/internal/apptxn_test.go
Outdated
ApprovalProgram: main(` | ||
int 3 | ||
int 3 | ||
== | ||
assert | ||
`), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can actually leave this out and txntest.Txn will supply a passing ApprovalProgram.
ledger/internal/apptxn_test.go
Outdated
genBalances, addrs, _ := ledgertesting.NewTestGenesis() | ||
l := newTestLedger(t, genBalances) | ||
defer l.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if this was also testConsensusRange so that it tests all the versions, starting with the first that works, through vFuture as we add more and more versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for those consensusRange changes. They make me feel much more confident as we change things in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
This is great! Thank you for implementing! |
Summary
The AVM allows access to a few different categories of accounts: the current app's, those belonging to apps created previously in the tx group, and those provided by the
accounts
tx field. The PR expands this set to include the accounts belonging to the apps provided by theforeign_apps
tx field.Test Plan
The standard unit tests for
eval.go
don't have access to a sufficiently featured ledger so the tests were added toledger/internal
instead.