-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2128 from AleoHQ/fix/ignore-finalize
[Fix] Validating futures.
- Loading branch information
Showing
22 changed files
with
423 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/async_without_finalize_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program child.aleo: ''child.aleo/foo'' does not have a finalize block' | ||
outputs: [] |
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/call_after_async_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program parent.aleo: The ''call'' can only be invoked before an ''async'' instruction' | ||
outputs: [] |
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/future_out_of_order_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program parent.aleo: Function ''foo'' contains futures, but the ''async'' instruction does not consume all of them in the order they were produced' | ||
outputs: [] |
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/ignore_finalize_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program parent.aleo: Function ''parent.aleo/foo'' must contain a finalize block, since it calls ''child.aleo/foo''.' | ||
outputs: [] |
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/last_reg_is_not_future_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program child.aleo: The last output of function ''foo'' must be a future associated with itself' | ||
outputs: [] |
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/multiple_async_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program parent.aleo: Function ''foo'' can contain at most one ''async'' instruction' | ||
outputs: [] |
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/out_of_order_await_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program parent.aleo: Futures in finalize ''foo'' are not awaited in the order they are passed in.' | ||
outputs: [] |
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/output_child_without_async_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program parent.aleo: Function ''parent.aleo/foo'' must contain a finalize block, since it calls ''child.aleo/foo''.' | ||
outputs: [] |
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/unawaited_future_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program parent.aleo: Futures in finalize ''foo'' are not awaited in the order they are passed in.' | ||
outputs: [] |
3 changes: 3 additions & 0 deletions
3
synthesizer/tests/expectations/vm/execute_and_finalize/unused_future_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
errors: | ||
- 'Failed to run `VM::deploy for program parent.aleo: Function ''foo'' contains futures, but the ''async'' instruction does not consume all of them in the order they were produced' | ||
outputs: [] |
17 changes: 17 additions & 0 deletions
17
synthesizer/tests/tests/vm/execute_and_finalize/async_without_finalize_fail.aleo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
randomness: 45791624 | ||
cases: [] | ||
*/ | ||
|
||
program child.aleo; | ||
|
||
function foo: | ||
input r0 as field.private; | ||
input r1 as field.private; | ||
async foo self.caller into r2; | ||
add r0 r1 into r3; | ||
output r3 as field.private; | ||
|
||
|
||
|
||
|
37 changes: 37 additions & 0 deletions
37
synthesizer/tests/tests/vm/execute_and_finalize/call_after_async_fail.aleo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
randomness: 45791624 | ||
cases: [] | ||
*/ | ||
|
||
program child.aleo; | ||
|
||
mapping count: | ||
key as address.public; | ||
value as field.public; | ||
|
||
function foo: | ||
async foo self.caller into r0; | ||
output r0 as child.aleo/foo.future; | ||
|
||
finalize foo: | ||
input r0 as address.public; | ||
get.or_use count[r0] 0field into r1; | ||
add r1 1field into r2; | ||
set r2 into count[r0]; | ||
|
||
///////////////////////////////////////////////// | ||
|
||
import child.aleo; | ||
|
||
program parent.aleo; | ||
|
||
function foo: | ||
call child.aleo/foo into r0; | ||
async foo r0 into r1; | ||
call child.aleo/foo into r2; | ||
output r1 as parent.aleo/foo.future; | ||
|
||
finalize foo: | ||
input r0 as child.aleo/foo.future; | ||
await r0; | ||
|
39 changes: 39 additions & 0 deletions
39
synthesizer/tests/tests/vm/execute_and_finalize/future_out_of_order_fail.aleo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
randomness: 45791624 | ||
cases: [] | ||
*/ | ||
|
||
program child.aleo; | ||
|
||
mapping count: | ||
key as address.public; | ||
value as field.public; | ||
|
||
function foo: | ||
async foo self.caller into r0; | ||
output r0 as child.aleo/foo.future; | ||
|
||
finalize foo: | ||
input r0 as address.public; | ||
get.or_use count[r0] 0field into r1; | ||
add r1 1field into r2; | ||
set r2 into count[r0]; | ||
|
||
///////////////////////////////////////////////// | ||
|
||
import child.aleo; | ||
|
||
program parent.aleo; | ||
|
||
function foo: | ||
call child.aleo/foo into r0; | ||
call child.aleo/foo into r1; | ||
async foo r1 r0 into r2; | ||
output r2 as parent.aleo/foo.future; | ||
|
||
finalize foo: | ||
input r0 as child.aleo/foo.future; | ||
input r1 as child.aleo/foo.future; | ||
await r0; | ||
await r1; | ||
|
33 changes: 33 additions & 0 deletions
33
synthesizer/tests/tests/vm/execute_and_finalize/ignore_finalize_fail.aleo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
randomness: 45791624 | ||
cases: [] | ||
*/ | ||
|
||
program child.aleo; | ||
|
||
mapping count: | ||
key as address.public; | ||
value as field.public; | ||
|
||
function foo: | ||
async foo self.caller into r0; | ||
output r0 as child.aleo/foo.future; | ||
|
||
finalize foo: | ||
input r0 as address.public; | ||
get.or_use count[r0] 0field into r1; | ||
add r1 1field into r2; | ||
set r2 into count[r0]; | ||
|
||
///////////////////////////////////////////////// | ||
|
||
import child.aleo; | ||
|
||
program parent.aleo; | ||
|
||
function foo: | ||
input r0 as field.private; | ||
input r1 as field.private; | ||
call child.aleo/foo into r2; | ||
add r0 r1 into r3; | ||
output r3 as field.private; |
25 changes: 25 additions & 0 deletions
25
synthesizer/tests/tests/vm/execute_and_finalize/last_reg_is_not_future_fail.aleo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
randomness: 45791624 | ||
cases: [] | ||
*/ | ||
|
||
program child.aleo; | ||
|
||
mapping count: | ||
key as address.public; | ||
value as field.public; | ||
|
||
function foo: | ||
input r0 as field.private; | ||
input r1 as field.private; | ||
async foo self.caller into r2; | ||
add r0 r1 into r3; | ||
output r2 as child.aleo/foo.future; | ||
output r3 as field.private; | ||
|
||
finalize foo: | ||
input r0 as address.public; | ||
get.or_use count[r0] 0field into r1; | ||
add r1 1field into r2; | ||
set r2 into count[r0]; | ||
|
38 changes: 38 additions & 0 deletions
38
synthesizer/tests/tests/vm/execute_and_finalize/multiple_async_fail.aleo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
randomness: 45791624 | ||
cases: [] | ||
*/ | ||
|
||
program child.aleo; | ||
|
||
mapping count: | ||
key as address.public; | ||
value as field.public; | ||
|
||
function foo: | ||
async foo self.caller into r0; | ||
output r0 as child.aleo/foo.future; | ||
|
||
finalize foo: | ||
input r0 as address.public; | ||
get.or_use count[r0] 0field into r1; | ||
add r1 1field into r2; | ||
set r2 into count[r0]; | ||
|
||
///////////////////////////////////////////////// | ||
|
||
import child.aleo; | ||
|
||
program parent.aleo; | ||
|
||
function foo: | ||
call child.aleo/foo into r0; | ||
call child.aleo/foo into r1; | ||
async foo r0 into r2; | ||
async foo r1 into r3; | ||
output r2 as parent.aleo/foo.future; | ||
|
||
finalize foo: | ||
input r0 as child.aleo/foo.future; | ||
await r0; | ||
|
39 changes: 39 additions & 0 deletions
39
synthesizer/tests/tests/vm/execute_and_finalize/out_of_order_await_fail.aleo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
randomness: 45791624 | ||
cases: [] | ||
*/ | ||
|
||
program child.aleo; | ||
|
||
mapping count: | ||
key as address.public; | ||
value as field.public; | ||
|
||
function foo: | ||
async foo self.caller into r0; | ||
output r0 as child.aleo/foo.future; | ||
|
||
finalize foo: | ||
input r0 as address.public; | ||
get.or_use count[r0] 0field into r1; | ||
add r1 1field into r2; | ||
set r2 into count[r0]; | ||
|
||
///////////////////////////////////////////////// | ||
|
||
import child.aleo; | ||
|
||
program parent.aleo; | ||
|
||
function foo: | ||
call child.aleo/foo into r0; | ||
call child.aleo/foo into r1; | ||
async foo r0 r1 into r2; | ||
output r2 as parent.aleo/foo.future; | ||
|
||
finalize foo: | ||
input r0 as child.aleo/foo.future; | ||
input r1 as child.aleo/foo.future; | ||
await r1; | ||
await r0; | ||
|
Oops, something went wrong.