Skip to content

refactor(pxe): hash oracle registry instead of Oracle class#23907

Merged
nchamo merged 3 commits into
merge-train/fairies-v5from
nchamo/pxe-oracle-hash-calc
Jun 5, 2026
Merged

refactor(pxe): hash oracle registry instead of Oracle class#23907
nchamo merged 3 commits into
merge-train/fairies-v5from
nchamo/pxe-oracle-hash-calc

Conversation

@nchamo

@nchamo nchamo commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The oracle interface hash (ORACLE_INTERFACE_HASH) is now computed by AST-parsing the ORACLE_REGISTRY declaration instead of the Oracle class. The old approach only captured oracle names (every method shared the same erased ACVMField signature), so changes to parameter types, parameter names, or return types went undetected. The registry-based hash is sensitive to all of these.
  • Adds getOracleRegistrySignature to parse registry entries, capturing each oracle's makeEntry params and return type as source text. Spread elements (used by TXE_ORACLE_REGISTRY) are explicitly rejected for now.
  • Renames the test file to oracle_version_helpers.test.ts to match the module it tests.

@nchamo nchamo self-assigned this Jun 5, 2026
@@ -1,55 +0,0 @@
import { mkdtempSync, rmSync, writeFileSync } from 'fs';

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 was just moved to another file

@nchamo nchamo requested a review from vezenovm June 5, 2026 15:18
* changes, not just oracle additions and removals.
*
* Type expressions are captured as their source text (e.g. `OPTION(AZTEC_ADDRESS)`, `BOUNDED_VEC(NOTE)`), so the
* signature tracks the composition of types. A change to how a leaf `TypeMapping` serializes without renaming it is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure what this last sentence means, can you elaborate? Is this referencing a possible extension that doesn't exist here?

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 rewrote it as:

 * Type expressions are captured as their source text (e.g. `OPTION(AZTEC_ADDRESS)`, `BOUNDED_VEC(NOTE)`), so the
 * signature tracks the composition of types. However, if the internal serialization logic of a `TypeMapping` constant
 * (e.g. `FIELD`) changes without the constant being renamed, the hash will not change.

Comment thread yarn-project/pxe/src/bin/oracle_version_helpers.test.ts Outdated
@nchamo nchamo merged commit 6a0fa5d into merge-train/fairies-v5 Jun 5, 2026
12 checks passed
@nchamo nchamo deleted the nchamo/pxe-oracle-hash-calc branch June 5, 2026 18:06
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.

2 participants