Skip to content

refactor!: cleaning up public call and tx phase related oracles#21209

Open
benesjan wants to merge 7 commits intomerge-train/fairiesfrom
03-06-refactor_cleaning_up_public_call_related_oracles
Open

refactor!: cleaning up public call and tx phase related oracles#21209
benesjan wants to merge 7 commits intomerge-train/fairiesfrom
03-06-refactor_cleaning_up_public_call_related_oracles

Conversation

@benesjan
Copy link
Contributor

@benesjan benesjan commented Mar 6, 2026

In this PR I focused on cleaning up the public call and tx phase related oracles. Below is the AI summary and I put github comments in the files that should hopefully make all the changes clear.

This is the most important piece of the before-alpha-oracle cleanup (issue here) as this seems like by far the most sad part of the oracle code.

AI Summary

Cleans up the public call related oracles in the private execution context:

  • Replaces enqueue_public_function_call module with two focused modules: public_call (calldata validation) and tx_phase (revertible phase tracking), giving each oracle a clear single responsibility
  • Simplifies validate_public_calldata: the old notifyEnqueuedPublicFunctionCall and notifySetPublicTeardownFunctionCall oracles both did the same thing (validate calldata) but received unused parameters (contract address, counter, is_static_call). The new validatePublicCalldata oracle only takes the calldata hash
  • Renames phase-related oracles for clarity: notifySetMinRevertibleSideEffectCounternotifyRevertiblePhaseStart, isSideEffectCounterRevertibleinRevertiblePhase

Copy link
Contributor Author

benesjan commented Mar 6, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@benesjan benesjan force-pushed the 03-06-refactor_cleaning_up_public_call_related_oracles branch from 9bf6224 to ddb514b Compare March 8, 2026 06:07
is_static_call: bool,
hide_msg_sender: bool,
) {
let counter = self.next_counter();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that here the counter was truly unnecessary because:

  1. it was unused by notify_set_public_teardown_function_call,
  2. fundamentally we don't care about counters on teardown calls because there can be only 1 teardown call (and hence no ordering is needed).

@@ -1,101 +0,0 @@
use crate::protocol::address::AztecAddress;
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 file was very sad because:

  1. Most of the args of notify_enqueued_public_function_call_oracle were unused,
  2. we had 2 versions of notify_enqueued_public_function_call_oracle: one for teardown one for standard public call but they were doing the identical thing,
  3. the tx phase oracles (notify_set_min_revertible_side_effect_counter_oracle_wrapper, is_side_effect_counter_revertible) were not really related to public calls so I moved them to a separate tx_phase.nr file.

///
/// The check is unconstrained and the only purpose of it is to fail early in case of calldata overflow or a bug in
/// calldata hashing.
pub fn validate_public_calldata(calldata_hash: Field) {
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 used to be called notify_enqueued_public_function_call and notify_set_public_teardown_function.

@@ -4,10 +4,8 @@ use crate::{
messaging::process_l1_to_l2_message,
Copy link
Contributor Author

@benesjan benesjan Mar 8, 2026

Choose a reason for hiding this comment

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

The changes in aztec_sublib are a copy-paste from real Aztec.nr so no need to pay attention to this.

After all the protocol circuits did not yet went for audit so doing the changes here should be fine.

@benesjan benesjan marked this pull request as ready for review March 8, 2026 07:11
@benesjan benesjan requested a review from nventuro as a code owner March 8, 2026 07:11
@benesjan benesjan changed the title refactor: cleaning up public call related oracles refactor!: cleaning up public call and tx phase related oracles Mar 8, 2026
@benesjan benesjan requested a review from mverzilli March 8, 2026 07:30
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.

1 participant