-
Notifications
You must be signed in to change notification settings - Fork 615
fix: allow returning of tuples from contract funcs #14553
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
Merged
nventuro
merged 7 commits into
master
from
05-27-fix_allow_of_returning_of_tuples_from_contract_funcs
May 29, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5798ffd
fix: allow of returning of tuples from contract funcs
benesjan ffda0d6
works
benesjan dbd4d17
Update noir-projects/noir-contracts/contracts/test/returning_tuple_co…
benesjan 9e95265
Update noir-projects/noir-contracts/contracts/test/returning_tuple_co…
benesjan 70c629e
removing redundant pub keyword
benesjan acbffc3
testing tuple value gets correctly decoded
benesjan acb4858
fix: correctly decoding string return value (#14603)
benesjan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
8 changes: 8 additions & 0 deletions
8
noir-projects/noir-contracts/contracts/test/returning_tuple_contract/Nargo.toml
This file contains hidden or 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,8 @@ | ||
| [package] | ||
| name = "returning_tuple_contract" | ||
| authors = [""] | ||
| compiler_version = ">=0.25.0" | ||
| type = "contract" | ||
|
|
||
| [dependencies] | ||
| aztec = { path = "../../../../aztec-nr/aztec" } |
47 changes: 47 additions & 0 deletions
47
noir-projects/noir-contracts/contracts/test/returning_tuple_contract/src/main.nr
This file contains hidden or 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,47 @@ | ||
| use aztec::macros::aztec; | ||
|
|
||
| // Tests that Aztec.nr handles returning tuples correctly. | ||
| #[aztec] | ||
| pub contract ReturningTuple { | ||
| use aztec::{ | ||
| macros::functions::{private, view}, | ||
| prelude::{AztecAddress, Point}, | ||
| protocol_types::traits::{Deserialize, FromField}, | ||
| }; | ||
|
|
||
| #[private] | ||
| #[view] | ||
| fn fn_that_returns_1() -> (bool,) { | ||
| (true,) | ||
| } | ||
|
|
||
| #[private] | ||
| #[view] | ||
| fn fn_that_returns_2() -> (Field, u32) { | ||
| (1, 2) | ||
| } | ||
|
|
||
| #[private] | ||
| #[view] | ||
| fn fn_that_returns_3() -> (Field, bool, str<4>) { | ||
| (1, true, "test") | ||
| } | ||
|
|
||
| #[private] | ||
| #[view] | ||
| fn fn_that_returns_4() -> (Field, u64, bool, str<3>) { | ||
| (1, 2, false, "abc") | ||
| } | ||
|
|
||
| #[private] | ||
| #[view] | ||
| fn fn_that_returns_5() -> (Field, u32, bool, str<2>, i64) { | ||
| (1, 2, true, "hi", -5) | ||
| } | ||
|
|
||
| #[private] | ||
| #[view] | ||
| fn fn_that_returns_6() -> (Field, u128, bool, str<3>, AztecAddress, Point) { | ||
| (1, 2, false, "xyz", AztecAddress::from_field(1), Point::deserialize([1, 2, 3])) | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.