feat(pxe): implement minor/major oracle version tracking#22254
feat(pxe): implement minor/major oracle version tracking#22254benesjan wants to merge 6 commits intomerge-train/fairiesfrom
Conversation
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)]), |
There was a problem hiding this comment.
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).
- 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)] |
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
AI Summary
Implements F-507: minor/major oracle version tracking.
ORACLE_VERSION(22) intoORACLE_VERSION_MAJOR(22) andORACLE_VERSION_MINOR(0) on both Noir and TypeScript sides