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

Test Boxes field in application calls static array #181

Merged
merged 17 commits into from
Jun 7, 2022

Conversation

algochoi
Copy link
Contributor

This PR provides SDK tests for application transactions with the new boxes field:

  • Added encoding tests for boxes in application transactions

SDK implementation:

TODO:

  • Add integration tests for box references in application calls (Will be handled in a later PR after box read API is implemented)
  • Add tests for Atomic Transaction Composer (Is this necessary?)

Tracks #175

@algochoi algochoi marked this pull request as ready for review May 25, 2022 20:18
@algochoi algochoi changed the title Box reference Test Boxes field in application calls static array May 25, 2022
@algochoi algochoi requested a review from algoidurovic May 25, 2022 20:18
export ALGOD_URL="https://github.com/algorand/go-algorand"
export ALGOD_BRANCH="master"
export ALGOD_URL="https://github.com/jannotti/go-algorand"
export ALGOD_BRANCH="avm-box"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently points to the fork, but should revert this back before merging to master.

@tzaffi
Copy link
Contributor

tzaffi commented Jun 1, 2022

  • Add tests for Atomic Transaction Composer (Is this necessary?)

I think this would be nice to have if not essential. Currently the step variants of "add a method call with the signing account" do not claim the ability to add reference arg arrays to the method call (i.e. accounts, foreign_apps, foreign_assets, and boxes). This seems like an important feature to test, but since the existing tests are so intricate, a smallish new scenario focusing on this aspect might make the most sense.

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

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

Left a couple of comments/questions.

It seems that this is a "placeholder" PR which isn't concretely asserting anything about how boxes are handled. Is this true, and if so, are we waiting on algod code in the go-algorand boxes branch in order to understand the box API, and only then can we spell out precisely what the test will be?

@algochoi
Copy link
Contributor Author

algochoi commented Jun 1, 2022

Appreciate the quick feedback:

I think this would be nice to have if not essential. Currently the step variants of "add a method call with the signing account" do not claim the ability to add reference arg arrays to the method call (i.e. accounts, foreign_apps, foreign_assets, and boxes). This seems like an important feature to test, but since the existing tests are so intricate, a smallish new scenario focusing on this aspect might make the most sense.

I think that makes sense like an integration test for the boxes field.

It seems that this is a "placeholder" PR which isn't concretely asserting anything about how boxes are handled. Is this true, and if so, are we waiting on algod code in the go-algorand boxes branch in order to understand the box API, and only then can we spell out precisely what the test will be?

Yes, the next part will be to implement the algod APIs to read from boxes. Then we can assert round-trip results (create, write, read from boxes) in the integration tests with some TEAL code, probably in a new PR to the feature/box-storage branch.

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

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

I believe this is probably approvable but must confess to my not understanding exactly what is going on. Could you explain how the test is actually doing anything? Specifically, in features/unit/transactions.feature I see that one can allow boxes to be added to an ApplicationCallTxn. The hash of the txn should then reflect this new information, and this should create a totally new "golden". Is this understanding correct and are the golden's reflecting the expected transaction hash which includes boxes?

@algochoi
Copy link
Contributor Author

algochoi commented Jun 3, 2022

The hash of the txn should then reflect this new information, and this should create a totally new "golden". Is this understanding correct and are the golden's reflecting the expected transaction hash which includes boxes?

That's correct - it's checking if the boxes are encoded in the appl static box arrays. You can also visually check by taking the b64 encoded golden msgpack format and decoding it back to JSON to reverse engineer the new fields in the transaction.

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

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

LGTM

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.

The encoding tests look good, I just left a comment about another case I'd like to see. I'll approve since this is going into a feature branch, so not everything needs to be complete yet

features/unit/transactions.feature Show resolved Hide resolved
@algochoi algochoi merged commit 2a3f9d1 into feature/box-storage Jun 7, 2022
@algochoi algochoi deleted the box-reference branch June 7, 2022 14:39
@algochoi algochoi restored the box-reference branch June 7, 2022 15:00
@michaeldiamant michaeldiamant deleted the box-reference branch June 9, 2022 13:52
@michaeldiamant michaeldiamant restored the box-reference branch June 9, 2022 13:52
@algochoi algochoi deleted the box-reference branch August 2, 2022 19:08
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