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

Feature: Box Storage #192

Merged
merged 37 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2a3f9d1
Test Boxes field in application calls static array (#181)
algochoi Jun 7, 2022
10e24bd
Update box testing branch
algochoi Jun 14, 2022
b3a2ffe
Merge branch 'master' into feature/box-storage
algochoi Jun 16, 2022
03659b9
Box API Tests (#187)
algochoi Jun 21, 2022
e039eba
Box Integration Test (#196)
algoidurovic Jun 22, 2022
78d60a1
Reverse steps for funding app account (#197)
algochoi Jun 29, 2022
f24bbc3
Updated Box path tests using new encoding scheme (#203)
algochoi Jun 30, 2022
5dfacb7
Box Storage: List boxes API tests (#208)
algochoi Jul 15, 2022
ed53830
Merge branch 'master' into feature/box-storage
algochoi Aug 3, 2022
de9d9d2
Add swapping to new box program
algochoi Aug 3, 2022
8945611
Compile box teal app from source file than binary
algochoi Aug 3, 2022
e2f4ac3
Bump up program version to 8
algochoi Aug 3, 2022
5a75a62
Merge branch 'master' into feature/box-storage
algochoi Aug 22, 2022
9da7528
Use testing branches for box-storage
algochoi Aug 22, 2022
cf06c9e
Change indexer branch
algochoi Aug 22, 2022
d61dd6d
Change indexer to master
algochoi Aug 23, 2022
2112e6f
Remove channel
algochoi Aug 23, 2022
5452bdb
Reverse verbose option
algochoi Aug 23, 2022
f1d776e
Try different sourcemap file
algochoi Aug 23, 2022
0a0ce95
Enhancement: Merge `master` to `feature/box-storage` conflict resolvi…
ahangsu Sep 2, 2022
c8800ac
Merge branch 'master' into feature/box-storage
ahangsu Sep 2, 2022
e7c55e1
WIP: Test Indexer boxes functionality (#219)
algochoi Sep 6, 2022
34d7ca3
Update .env
ahangsu Sep 6, 2022
e583330
Update .env
ahangsu Sep 14, 2022
b6cee0c
Integration Test for Box endpoints in Indexer (#232)
ahangsu Sep 14, 2022
fb3e523
add approval teal prog 8 (#235)
ahangsu Sep 20, 2022
0805706
applications.boxes in the README (#236)
tzaffi Sep 20, 2022
06d25b8
Remove Comment in Favor of Issue #237 (#238)
tzaffi Sep 21, 2022
02d9b31
minor (#240)
ahangsu Sep 21, 2022
fb44594
Merge branch 'master' into update_again
michaeldiamant Oct 31, 2022
cc9d261
Remove assertion that no longer reliably works after go-algorand#4689
michaeldiamant Oct 31, 2022
dd0a3ba
Merge pull request #246 from michaeldiamant/update_again
michaeldiamant Oct 31, 2022
ec21e9d
Update .env
tzaffi Oct 31, 2022
a905181
Update .env
tzaffi Oct 31, 2022
0f30614
Update .env
tzaffi Nov 1, 2022
1df86fa
Switch back to nightly algod builds
michaeldiamant Nov 1, 2022
e7ac28e
Revert to algod channel builds
michaeldiamant Nov 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
VERBOSE_HARNESS=0

# Used to determine sandbox build type:
TYPE="channel" # OR "source"
TYPE="source" # OR "source"
ahangsu marked this conversation as resolved.
Show resolved Hide resolved
michaeldiamant marked this conversation as resolved.
Show resolved Hide resolved

# Used when TYPE==channel:
ALGOD_CHANNEL="nightly"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ These reside in the [integration features directory](features/integration)
| ---------------------- | -------------------------------------------------------------------------------------- |
| @abi | Test the Application Binary Interface (ABI) with atomic txn composition and execution. |
| @algod | General tests against algod REST endpoints. |
| @applications.boxes | Test application boxes and box references functionality. |
| @applications.verified | Submit all types of application transactions and verify account state. |
| @assets | Submit all types of asset transactions. |
| @auction | Encode and decode bids for an auction. |
| @c2c | Test Contract to Contract invocations and injestion. |
| @compile | Test the algod compile endpoint. |
| @compile.sourcemap | Test the algod compile endpoint returns a valid Source Map |
| @compile.sourcemap | Test the algod compile endpoint returns a valid Source Map |
| @dryrun | Test the algod dryrun endpoint. |
| @dryrun.testing | Test the testing harness that relies on dryrun endpoint. Python only. |
| @kmd | Test the kmd REST endpoints. |
Expand Down
4 changes: 2 additions & 2 deletions features/integration/abi.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: ABI Interaction
And suggested transaction parameters from the algod v2 client
And I create a new transient account and fund it with 100000000 microalgos.
And I make a transaction signer for the transient account.
And I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/abi_method_call.teal.tok", clear-program "programs/one.teal.tok", global-bytes 0, global-ints 0, local-bytes 1, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0
And I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/abi_method_call.teal.tok", clear-program "programs/one.teal.tok", global-bytes 0, global-ints 0, local-bytes 1, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0, boxes ""
And I sign and submit the transaction, saving the txid. If there is an error it is "".
And I wait for the transaction to be confirmed.
And I remember the new application ID.
Expand Down Expand Up @@ -100,7 +100,7 @@ Feature: ABI Interaction
Scenario: Method call delete execution
Given I create a new transient account and fund it with 100000000 microalgos.
And I make a transaction signer for the transient account.
And I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/abi_method_call.teal.tok", clear-program "programs/one.teal.tok", global-bytes 0, global-ints 0, local-bytes 1, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0
And I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/abi_method_call.teal.tok", clear-program "programs/one.teal.tok", global-bytes 0, global-ints 0, local-bytes 1, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0, boxes ""
And I sign and submit the transaction, saving the txid. If there is an error it is "".
And I wait for the transaction to be confirmed.
And I remember the new application ID.
Expand Down
154 changes: 139 additions & 15 deletions features/integration/applications.feature

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions features/integration/c2c.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Contract to Contract Interaction
* I reset the array of application IDs to remember.

###### ------ app at context index 0: FakeRandom ------ ######
When I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/fake_random.teal", clear-program "programs/six.teal", global-bytes 0, global-ints 1, local-bytes 0, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0
When I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/fake_random.teal", clear-program "programs/six.teal", global-bytes 0, global-ints 1, local-bytes 0, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0, boxes ""
And I sign and submit the transaction, saving the txid. If there is an error it is "".
And I wait for the transaction to be confirmed.
Given I remember the new application ID.
Expand Down Expand Up @@ -42,7 +42,7 @@ Feature: Contract to Contract Interaction
And I can dig the 1th atomic result with path "txn.txn.type" and see the value "appl"

###### ------ app at context index 1: RandomByte ------ ######
When I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/random_byte.teal", clear-program "programs/six.teal", global-bytes 0, global-ints 0, local-bytes 0, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0
When I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/random_byte.teal", clear-program "programs/six.teal", global-bytes 0, global-ints 0, local-bytes 0, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0, boxes ""
And I sign and submit the transaction, saving the txid. If there is an error it is "".
And I wait for the transaction to be confirmed.
Given I remember the new application ID.
Expand Down Expand Up @@ -80,7 +80,7 @@ Feature: Contract to Contract Interaction
And I can dig the 1th atomic result with path "inner-txns.0.txn.txn.type" and see the value "appl"

###### ----- app at context index 2: SlotMachine ----- ######
When I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/slot_machine.teal", clear-program "programs/six.teal", global-bytes 3, global-ints 1, local-bytes 0, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0
When I build an application transaction with the transient account, the current application, suggested params, operation "create", approval-program "programs/slot_machine.teal", clear-program "programs/six.teal", global-bytes 3, global-ints 1, local-bytes 0, local-ints 0, app-args "", foreign-apps "", foreign-assets "", app-accounts "", extra-pages 0, boxes ""
And I sign and submit the transaction, saving the txid. If there is an error it is "".
And I wait for the transaction to be confirmed.
Given I remember the new application ID.
Expand Down
5 changes: 3 additions & 2 deletions features/integration/compile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ Feature: Compile
| teal | program |
| programs/one.teal | programs/one.teal.tok |
| programs/zero.teal | programs/zero.teal.tok |
| programs/eight.teal | programs/eight.teal.tok |
| programs/abi_method_call.teal | programs/abi_method_call.teal.tok |

@compile.sourcemap
Scenario Outline: Algod compiling Teal returns a valid Source Map
When I compile a teal program "<teal>" with mapping enabled
Then the resulting source map is the same as the json "<sourcemap>"
Examples:
| teal | sourcemap |
| programs/quine.teal | v2algodclient_responsejsons/sourcemap.json |
| teal | sourcemap |
| programs/quine.teal | v2algodclient_responsejsons/sourcemap.json |
58 changes: 58 additions & 0 deletions features/resources/programs/box_app.teal
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#pragma version 8
txn ApplicationID
bz end
txn ApplicationArgs 0 // [arg[0]] // fails if no args && app already exists
byte "create" // [arg[0], "create"] // create box named arg[1]
== // [arg[0]=?="create"]
bz del // "create" ? continue : goto del
int 24 // [24]
txn NumAppArgs // [24, NumAppArgs]
int 2 // [24, NumAppArgs, 2]
== // [24, NumAppArgs=?=2]
bnz default // THIS IS POORLY BEHAVED WHEN "create" && NumAppArgs != 2
pop // get rid of 24 // NumAppArgs != 2
txn ApplicationArgs 2 // [arg[2]]
btoi // [btoi(arg[2])]
default: // [24] // NumAppArgs == 2
txn ApplicationArgs 1 // [24, arg[1]]
swap
box_create // [] // boxes: arg[1] -> [24]byte
assert
b end
del: // delete box arg[1]
txn ApplicationArgs 0 // [arg[0]]
byte "delete" // [arg[0], "delete"]
== // [arg[0]=?="delete"]
bz set // "delete" ? continue : goto set
txn ApplicationArgs 1 // [arg[1]]
box_del // del boxes[arg[1]]
assert
b end
set: // put arg[1] at start of box arg[0] ... so actually a _partial_ "set"
txn ApplicationArgs 0 // [arg[0]]
byte "set" // [arg[0], "set"]
== // [arg[0]=?="set"]
bz test // "set" ? continue : goto test
txn ApplicationArgs 1 // [arg[1]]
int 0 // [arg[1], 0]
txn ApplicationArgs 2 // [arg[1], 0, arg[2]]
box_replace // [] // boxes: arg[1] -> replace(boxes[arg[1]], 0, arg[2])
b end
test: // fail unless arg[2] is the prefix of box arg[1]
txn ApplicationArgs 0 // [arg[0]]
byte "check" // [arg[0], "check"]
== // [arg[0]=?="check"]
bz bad // "check" ? continue : goto bad
txn ApplicationArgs 1 // [arg[1]]
int 0 // [arg[1], 0]
txn ApplicationArgs 2 // [arg[1], 0, arg[2]]
len // [arg[1], 0, len(arg[2])]
box_extract // [ boxes[arg[1]][0:len(arg[2])] ]
txn ApplicationArgs 2 // [ boxes[arg[1]][0:len(arg[2])], arg[2] ]
== // [ boxes[arg[1]][0:len(arg[2])]=?=arg[2] ]
assert // boxes[arg[1]].startwith(arg[2]) ? pop : ERROR
b end
bad:
err
end:
int 1
Binary file added features/resources/programs/box_app.teal.tok
Binary file not shown.
2 changes: 2 additions & 0 deletions features/resources/programs/eight.teal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#pragma version 8
int 8
1 change: 1 addition & 0 deletions features/resources/programs/eight.teal.tok
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�
2 changes: 2 additions & 0 deletions features/resources/programs/four.teal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#pragma version 4
int 4
1 change: 1 addition & 0 deletions features/resources/programs/four.teal.tok
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�
4 changes: 2 additions & 2 deletions features/unit/feetest.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Feature: Transaction fee test
Given a signing account with address "BH55E5RMBD4GYWXGX5W5PJ5JAHPGM5OXKDQH5DC4O2MGI7NW4H6VOE4CP4" and mnemonic "awful drop leaf tennis indoor begin mandate discover uncle seven only coil atom any hospital uncover make any climb actor armed measure need above hundred"

Scenario Outline: App Call Fee Test
When I build an application transaction with operation "<operation>", application-id <application-id>, sender "<sender>", approval-program "<approval-prog-file>", clear-program "<clear-prog-file>", global-bytes <global-bytes>, global-ints <global-ints>, local-bytes <local-bytes>, local-ints <local-ints>, app-args "<app-args>", foreign-apps "<foreign-apps>", foreign-assets "<foreign-assets>", app-accounts "<app-accounts>", fee <fee>, first-valid <first-valid>, last-valid <last-valid>, genesis-hash "<genesis-hash>", extra-pages <extra-pages>
When I build an application transaction with operation "<operation>", application-id <application-id>, sender "<sender>", approval-program "<approval-prog-file>", clear-program "<clear-prog-file>", global-bytes <global-bytes>, global-ints <global-ints>, local-bytes <local-bytes>, local-ints <local-ints>, app-args "<app-args>", foreign-apps "<foreign-apps>", foreign-assets "<foreign-assets>", app-accounts "<app-accounts>", fee <fee>, first-valid <first-valid>, last-valid <last-valid>, genesis-hash "<genesis-hash>", extra-pages <extra-pages>, boxes ""
And sign the transaction
Then fee field is in txn
When I build an application transaction with operation "<operation>", application-id <application-id>, sender "<sender>", approval-program "<approval-prog-file>", clear-program "<clear-prog-file>", global-bytes <global-bytes>, global-ints <global-ints>, local-bytes <local-bytes>, local-ints <local-ints>, app-args "<app-args>", foreign-apps "<foreign-apps>", foreign-assets "<foreign-assets>", app-accounts "<app-accounts>", fee 0, first-valid <first-valid>, last-valid <last-valid>, genesis-hash "<genesis-hash>", extra-pages <extra-pages>
When I build an application transaction with operation "<operation>", application-id <application-id>, sender "<sender>", approval-program "<approval-prog-file>", clear-program "<clear-prog-file>", global-bytes <global-bytes>, global-ints <global-ints>, local-bytes <local-bytes>, local-ints <local-ints>, app-args "<app-args>", foreign-apps "<foreign-apps>", foreign-assets "<foreign-assets>", app-accounts "<app-accounts>", fee 0, first-valid <first-valid>, last-valid <last-valid>, genesis-hash "<genesis-hash>", extra-pages <extra-pages>, boxes ""
And sign the transaction
Then fee field not in txn

Expand Down
Loading