Skip to content

Commit 9bf3319

Browse files
committed
wip
1 parent d154453 commit 9bf3319

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@
302302
"starknet",
303303
"staticcall",
304304
"stdlib",
305+
"stringifying",
305306
"struct",
306307
"structs",
307308
"subarray",

yarn-project/pxe/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
"@aztec/protocol-contracts": "workspace:^",
7777
"@aztec/simulator": "workspace:^",
7878
"@aztec/stdlib": "workspace:^",
79-
"json-stringify-deterministic": "1.0.12",
8079
"koa": "^2.16.1",
8180
"koa-router": "^12.0.0",
8281
"lodash.omit": "^4.5.0",

yarn-project/pxe/src/bin/check_oracle_version.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { keccak256String } from '@aztec/foundation/crypto';
22

3-
import deterministicStringify from 'json-stringify-deterministic';
4-
53
import { Oracle } from '../contract_function_simulator/oracle/oracle.js';
64
import { TypedOracle } from '../contract_function_simulator/oracle/typed_oracle.js';
75
import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
@@ -23,8 +21,13 @@ class OracleMock extends TypedOracle {}
2321
*/
2422
function assertOracleInterfaceMatches(): void {
2523
const oracle = new Oracle(new OracleMock('OracleMock'));
24+
const acirCallback = oracle.toACIRCallback();
25+
// Create a hashable representation of the oracle interface by concatenating its method names. Return values are
26+
// excluded from the hash calculation since they are typically arrays of fields and I didn't manage to reliably
27+
// stringify them.
28+
const oracleInterfaceMethodNames = Object.keys(acirCallback).sort().join('');
2629
// We use keccak256 here just because we already have it in the dependencies.
27-
const oracleInterfaceHash = keccak256String(deterministicStringify(oracle.toACIRCallback()));
30+
const oracleInterfaceHash = keccak256String(oracleInterfaceMethodNames);
2831
if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
2932
// This check exists only to notify you when you need to update the ORACLE_VERSION constant.
3033
throw new Error(

yarn-project/pxe/src/oracle_version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export const ORACLE_VERSION = 1;
88

99
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
1010
/// which in turn implies that you need to update the ORACLE_VERSION constant.
11-
export const ORACLE_INTERFACE_HASH = 'b48d38f93eaa084033fc5970bf96e559c33c4cdc07d889ab00b4d63f9590739d';
11+
export const ORACLE_INTERFACE_HASH = '99187c6367b331ca37f942f1c9dda38ee05d527048c93526f8c58479f5319d38';

yarn-project/yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,6 @@ __metadata:
12621262
"@types/node": "npm:^22.15.17"
12631263
jest: "npm:^30.0.0"
12641264
jest-mock-extended: "npm:^4.0.0"
1265-
json-stringify-deterministic: "npm:1.0.12"
12661265
koa: "npm:^2.16.1"
12671266
koa-router: "npm:^12.0.0"
12681267
lodash.omit: "npm:^4.5.0"

0 commit comments

Comments
 (0)