Skip to content

refactor: cleaning up flow of calls generation#18265

Merged
benesjan merged 1 commit intonextfrom
11-07-refactor_cleaning_up_flow_of_call_interface_generation
Nov 10, 2025
Merged

refactor: cleaning up flow of calls generation#18265
benesjan merged 1 commit intonextfrom
11-07-refactor_cleaning_up_flow_of_call_interface_generation

Conversation

@benesjan
Copy link
Contributor

@benesjan benesjan commented Nov 7, 2025

Before this PR we generate the external function calls when the external macro was run and then we added the result to registries for later to be obtained by the aztec macro.

This flow became unnecessarily complex because now the external macro just registers the function definitions in the external function registry and then it uses this registry to generate the __aztec_nr_internals__ functions in the aztec macro. We can use this same function registry also for generating the calls obviating the need for the call registries.

@benesjan benesjan changed the title refactor: cleaning up flow of call interface generation refactor: cleaning up flow of calls generation Nov 7, 2025
@benesjan benesjan changed the base branch from 10-24-feat_introducing_internal_ to graphite-base/18265 November 7, 2025 15:02
@benesjan benesjan force-pushed the 11-07-refactor_cleaning_up_flow_of_call_interface_generation branch from fd553a2 to d2467ff Compare November 7, 2025 15:14
@benesjan benesjan changed the base branch from graphite-base/18265 to 10-24-feat_introducing_internal_ November 7, 2025 15:14
@@ -4,10 +4,7 @@
//!
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved it from functions dir as it no longer made sense to have it there.

I want the functions dir to only contain the simple marker attributes and to move all the complex logic out of there.

@@ -39,10 +34,6 @@ comptime fn get_abi_relevant_attributes(f: FunctionDefinition) -> Quoted {
}

pub(crate) comptime fn transform_private(f: FunctionDefinition) -> Quoted {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These functions now became cleaner as the registration really had nothing to do here. I plan on renaming these functions to generate_{private,public,utility}_external to follow the naming of generate_{private,public}_internal and

// We generate structs and their implementations necessary for convenient functions calls.
let interface = generate_contract_interface(m);
let self_call_structs = generate_self_call_structs(m);
let self_call_structs = generate_external_function_self_calls_structs(m);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Somewhat unrelated but felt like the original function name was no longer descriptive enough.

/// `self.enqueue_self.some_public_function(args)`
/// - `EnqueueSelfStatic`: Enqueue your own view public functions, e.g.:
/// `self.enqueue_self_static.some_view_function(args)`
comptime fn generate_self_call_structs(m: Module) -> Quoted {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced with calls_generation::external_functions::generate_external_function_self_calls_structs

@benesjan benesjan marked this pull request as ready for review November 7, 2025 15:23
@@ -1,3 +1,6 @@
// TODO(benesjan): Instead of having this registry, just generate the authorize check when the given
// `__aztec_nr_internals__` function is being generated. Having this registry is completely unnecessary.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This registry is also unnecessary. Plan on tackling this once the stack is merged. (will go through all the "TODO(benesjan)" in the codebase once that's done and do the cleanups).

@benesjan benesjan requested a review from nventuro November 7, 2025 18:05
@benesjan benesjan force-pushed the 11-07-refactor_cleaning_up_flow_of_call_interface_generation branch from 5c45a7f to e9e3a26 Compare November 7, 2025 20:21
@benesjan benesjan force-pushed the 10-24-feat_introducing_internal_ branch from a541e1f to 8a87c75 Compare November 7, 2025 20:21
@benesjan benesjan marked this pull request as draft November 8, 2025 22:17
@benesjan benesjan force-pushed the 10-24-feat_introducing_internal_ branch from 8a87c75 to 58d83ff Compare November 8, 2025 22:18
@benesjan benesjan force-pushed the 11-07-refactor_cleaning_up_flow_of_call_interface_generation branch 2 times, most recently from dc586db to 5843610 Compare November 8, 2025 22:32
@benesjan benesjan force-pushed the 10-24-feat_introducing_internal_ branch 2 times, most recently from 803e713 to f59e55f Compare November 8, 2025 23:16
@benesjan benesjan force-pushed the 11-07-refactor_cleaning_up_flow_of_call_interface_generation branch from 5843610 to ffe6c15 Compare November 8, 2025 23:16
@benesjan benesjan force-pushed the 11-07-refactor_cleaning_up_flow_of_call_interface_generation branch from 6eedab5 to cc4088d Compare November 9, 2025 13:06
@benesjan benesjan force-pushed the 10-24-feat_introducing_internal_ branch from f59e55f to 8ba4963 Compare November 9, 2025 13:06
@benesjan benesjan marked this pull request as ready for review November 9, 2025 13:07
@AztecBot
Copy link
Collaborator

AztecBot commented Nov 9, 2025

Flakey Tests

🤖 says: This CI run detected 2 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033[38;2;188;109;208mFLAKED\033[0m (\033[38;2;250;217;121m8;;http://ci.aztec-labs.com/8d1692a60f39b515�8d1692a60f39b5158;;�\033[0m): yarn-project/scripts/run_test.sh p2p/src/services/reqresp/reqresp.test.ts (31s) (code: 1) group:e2e-p2p-epoch-flakes (\033[38;2;188;109;208mJan Beneš\033[0m: refactor: cleaning up flow of calls generation (#18265))
\033[38;2;188;109;208mFLAKED\033[0m (\033[38;2;250;217;121m8;;http://ci.aztec-labs.com/3166f99ea8592045�3166f99ea85920458;;�\033[0m): BOX=react BROWSER=firefox run_compose_test react-firefox box boxes (74s) (code: 1) (\033[38;2;188;109;208mJan Beneš\033[0m: refactor: cleaning up flow of calls generation (#18265))

@benesjan benesjan changed the base branch from 10-24-feat_introducing_internal_ to graphite-base/18265 November 10, 2025 14:23
@benesjan benesjan force-pushed the graphite-base/18265 branch from 8ba4963 to 571f69f Compare November 10, 2025 14:48
@benesjan benesjan force-pushed the 11-07-refactor_cleaning_up_flow_of_call_interface_generation branch from cc4088d to 09bfcdb Compare November 10, 2025 14:48
@benesjan benesjan changed the base branch from graphite-base/18265 to 10-24-feat_introducing_internal_ November 10, 2025 14:48
@AztecBot AztecBot force-pushed the 10-24-feat_introducing_internal_ branch 2 times, most recently from fd11b14 to 7241673 Compare November 10, 2025 15:11
Base automatically changed from 10-24-feat_introducing_internal_ to next November 10, 2025 15:49
@benesjan benesjan force-pushed the 11-07-refactor_cleaning_up_flow_of_call_interface_generation branch from 09bfcdb to afc0612 Compare November 10, 2025 15:52
@benesjan benesjan enabled auto-merge November 10, 2025 15:53
Before this PR we generate the external function calls when the external macro was run and then we added the result to registries for later to be obtained by the aztec macro.

This flow became unnecessarily complex because now the external macro just registers the function definitions in the external function registry and then it uses this registry to generate the `__aztec_nr_internals__` functions in the aztec macro. We can use this same function registry also for generating the calls obviating the need for the call registries.
@AztecBot AztecBot force-pushed the 11-07-refactor_cleaning_up_flow_of_call_interface_generation branch from afc0612 to e82cde7 Compare November 10, 2025 16:14
@benesjan benesjan added this pull request to the merge queue Nov 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 10, 2025
@benesjan benesjan added this pull request to the merge queue Nov 10, 2025
github-merge-queue bot pushed a commit that referenced this pull request Nov 10, 2025
Before this PR we generate the external function calls when the external
macro was run and then we added the result to registries for later to be
obtained by the aztec macro.

This flow became unnecessarily complex because now the external macro
just registers the function definitions in the external function
registry and then it uses this registry to generate the
`__aztec_nr_internals__` functions in the aztec macro. We can use this
same function registry also for generating the calls obviating the need
for the call registries.
Merged via the queue into next with commit 2095013 Nov 10, 2025
15 checks passed
@benesjan benesjan deleted the 11-07-refactor_cleaning_up_flow_of_call_interface_generation branch November 10, 2025 18:03
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