-
Notifications
You must be signed in to change notification settings - Fork 598
feat!: TXE single execution env #9183
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
Changes from all commits
2900390
67fd3fa
725f2e6
0640f2a
eec0c40
f0e9846
9d0d9f0
e581fb8
aa5c50b
20e91a2
8ed69e6
2027fba
70b1319
22da773
9e84eca
e030e09
4c2778a
d174d0c
1439b09
75fda87
268ff71
095f2af
070edb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,18 +104,10 @@ pub comptime fn stub_fn(f: FunctionDefinition) -> Quoted { | |
|
|
||
| let fn_name_len: u32 = unquote!(quote { $fn_name_str.as_bytes().len()}); | ||
|
|
||
| let arg_types_list: Quoted = fn_parameters.map(|(_, typ): (_, Type)| quote { $typ }).join(quote {,}); | ||
| let arg_types = if fn_parameters.len() == 1 { | ||
| // Extra colon to avoid it being interpreted as a parenthesized expression instead of a tuple | ||
| quote { ($arg_types_list,) } | ||
| } else { | ||
| quote { ($arg_types_list) } | ||
| }; | ||
|
|
||
| let call_interface_generics = if is_void { | ||
| quote { $fn_name_len, $arg_types } | ||
| quote { $fn_name_len } | ||
Thunkar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } else { | ||
| quote { $fn_name_len, $fn_return_type, $arg_types } | ||
| quote { $fn_name_len, $fn_return_type } | ||
| }; | ||
|
|
||
| let call_interface_name = f"dep::aztec::context::call_interfaces::{fn_visibility_capitalized}{is_static_call_capitalized}{is_void_capitalized}CallInterface".quoted_contents(); | ||
|
|
@@ -128,38 +120,6 @@ pub comptime fn stub_fn(f: FunctionDefinition) -> Quoted { | |
| quote {} | ||
| }; | ||
|
|
||
| let input_type = if is_fn_private(f) { | ||
| quote { crate::context::inputs::PrivateContextInputs }.as_type() | ||
| } else { | ||
| quote { () }.as_type() | ||
| }; | ||
|
|
||
| let return_type_hint = if is_fn_private(f) { | ||
| quote { protocol_types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs }.as_type() | ||
| } else { | ||
| fn_return_type | ||
| }; | ||
|
|
||
| let mut parameter_names_list = fn_parameters.map(|(name, _): (Quoted, _)| name); | ||
| let parameter_names = if is_fn_private(f) { | ||
| &[quote {inputs}].append(parameter_names_list).join(quote{,}) | ||
| } else { | ||
| parameter_names_list.join(quote {,}) | ||
| }; | ||
| let original = if is_fn_private(f) { | ||
| quote { | ||
| | inputs: $input_type | -> $return_type_hint { | ||
| $fn_name($parameter_names) | ||
| } | ||
| } | ||
| } else { | ||
| quote { | ||
| | _: $input_type | -> $return_type_hint { | ||
| unsafe { $fn_name($parameter_names) } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| let args_hash = if fn_visibility == quote { private } { | ||
| quote { $args_hash_name, } | ||
| } else { | ||
|
|
@@ -176,7 +136,7 @@ pub comptime fn stub_fn(f: FunctionDefinition) -> Quoted { | |
| name: $fn_name_str, | ||
| $args_hash | ||
| args: $args_acc_name, | ||
| original: $original, | ||
| return_type: std::mem::zeroed(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Call interfaces were sort of broken before. Return value types were unbound and that led to weird situations such as: #[private]
fn my_fn() -> u8 {...}
...
#[test]
fn test_my_fn() {
let result = MyContract::at(somewhere).my_fn().call(&mut env.private());
assert(result == 8 // this is a Field, so result is cast to Field);
}
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought I understood this, and did some reading around on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's similar to when we needed array hints in methods for length...we need a return_type variable with the correct |
||
| is_static: $is_static_call, | ||
| $gas_opts | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.