File tree Expand file tree Collapse file tree 5 files changed +8
-6
lines changed
Expand file tree Collapse file tree 5 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 302302 " starknet" ,
303303 " staticcall" ,
304304 " stdlib" ,
305+ " stringifying" ,
305306 " struct" ,
306307 " structs" ,
307308 " subarray" ,
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 11import { keccak256String } from '@aztec/foundation/crypto' ;
22
3- import deterministicStringify from 'json-stringify-deterministic' ;
4-
53import { Oracle } from '../contract_function_simulator/oracle/oracle.js' ;
64import { TypedOracle } from '../contract_function_simulator/oracle/typed_oracle.js' ;
75import { ORACLE_INTERFACE_HASH } from '../oracle_version.js' ;
@@ -23,8 +21,13 @@ class OracleMock extends TypedOracle {}
2321 */
2422function 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 (
Original file line number Diff line number Diff 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 ' ;
Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments