Skip to content

feat(pxe): implement minor/major oracle version tracking#22254

Open
benesjan wants to merge 6 commits intomerge-train/fairiesfrom
jan/f-507-implement-minormajor-oracle-version-tracking
Open

feat(pxe): implement minor/major oracle version tracking#22254
benesjan wants to merge 6 commits intomerge-train/fairiesfrom
jan/f-507-implement-minormajor-oracle-version-tracking

Conversation

@benesjan
Copy link
Copy Markdown
Contributor

@benesjan benesjan commented Apr 2, 2026

AI Summary

Implements F-507: minor/major oracle version tracking.

  • Splits ORACLE_VERSION (22) into ORACLE_VERSION_MAJOR (22) and ORACLE_VERSION_MINOR (0) on both Noir and TypeScript sides
  • Major version mismatch fails immediately (breaking changes must match exactly)
  • Minor version is stored by the PXE and used to provide enhanced error messages when an oracle callback is not found, indicating the contract likely needs a newer PXE/wallet version
  • Backward compatible: old contracts sending a single version field default to minor=0 via the optional parameter and legacy oracle mappings

benesjan and others added 3 commits April 2, 2026 06:41
Splits the oracle version from a single integer (22) into major.minor (22.0).
Major version mismatches fail immediately (breaking changes). Minor version
is stored and used to provide enhanced error messages when an oracle is not
found - indicating the contract likely needs a newer PXE version.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
): Promise<ACVMField[]> => oracle.aztec_utl_log(level, message, _ignoredFieldsSize, fields),
utilityAssertCompatibleOracleVersion: (version: ACVMField[]): Promise<ACVMField[]> =>
oracle.aztec_utl_assertCompatibleOracleVersion(version),
oracle.aztec_utl_assertCompatibleOracleVersion(version, [toACVMField(0)]),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This just sets the minor to 0 when used with legacy contracts (in this context legacy means contracts compiled with Aztec.nr version before the next release).

benesjan and others added 2 commits April 2, 2026 07:39
- Rename aztec_utl_assertCompatibleOracleVersion to
  aztec_utl_assertCompatibleOracleVersionV2 (2-arg: major, minor)
- Add legacy mapping for old 1-arg oracle name
- Improve "oracle not found" errors: suggest PXE upgrade when contract
  minor > PXE minor, suggest contract bug when PXE should support it
- Add warning log when contract version is unexpectedly not set
- Created F-546 to rename back on v5

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

#[oracle(aztec_utl_assertCompatibleOracleVersion)]
unconstrained fn assert_compatible_oracle_version_oracle(version: Field) {}
#[oracle(aztec_utl_assertCompatibleOracleVersionV2)]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had to do the oracle rename because otherwise the legacy oracle mappings would not work - the mapping would overshadow the new impl.

@@ -1,10 +1,17 @@
/// The ORACLE_VERSION constant is used to check that the oracle interface is in sync between PXE and Aztec.nr. We need
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a copy paste from real Aztec.nr.

Kesha told me the protocol contracts audit have not start yet so doing changes here doesn't matter yet - it might not matter even after the audit starts as I guess we will just pin a commit but did not spend much time thinking about this yet.

*/
export function buildLegacyOracleCallbacks(oracle: Oracle): ACIRCallback {
// If you are about to add a new mapping ensure that the old oracle name is different from the new one - this can
// commonly occur when only the args are getting modified.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Almost did this mistake myself but AI luckily saved me.

}

// eslint-disable-next-line camelcase
public non_oracle_function_getContractOracleVersion(): { major: number; minor: number } | undefined {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Given that this class is about oracle handlers think prefixing the function name with "non_oracle_function_" is a good standard to have.

There is one more non-oralce public function on the class - getOffchainEffects. Would rename that one as well in a followup if you agree with the approach.

@benesjan benesjan marked this pull request as ready for review April 2, 2026 08:25
@benesjan benesjan requested a review from nventuro as a code owner April 2, 2026 08:25
@benesjan benesjan requested review from mverzilli and removed request for nventuro April 2, 2026 08:25
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