@@ -27,6 +27,25 @@ export class UnavailableOracleError extends Error {
2727
2828/**
2929 * A data source that has all the apis required by Aztec.nr.
30+ *
31+ * ## Oracle naming conventions
32+ *
33+ * We try to keep oracle naming consistent, please see below the conventions we adhere to.
34+ *
35+ * Each oracle method name has the form `aztec_{scope}_{verb}{Object}`, where:
36+ *
37+ * - **Scope prefix** indicates the execution context required:
38+ * - `aztec_prv_` — available only during private function execution.
39+ * - `aztec_utl_` — available during both utility and private execution.
40+ *
41+ * - **Verb** signals the operation's semantics (verb-first, then object):
42+ * - `get` — read / lookup / get data from oracle into contract.
43+ * - `does`/`is`/`has` — predicate (returns boolean).
44+ * - `emit`/`notify` — propagate data from contract to oracle.
45+ * - `set` — contract driven oracle state mutation (capsules, execution cache, tagging, etc).
46+ * - `call` — trigger nested execution (control flow).
47+ * - `assert` — validate a condition, throw on failure.
48+ * - Standalone verbs (`delete`, `copy`, `decrypt`, `log`, etc) are used when no generic verb fits.
3049 */
3150export class Oracle {
3251 constructor ( private handler : IMiscOracle | IUtilityExecutionOracle | IPrivateExecutionOracle ) { }
@@ -109,13 +128,13 @@ export class Oracle {
109128
110129 // eslint-disable-next-line camelcase
111130 aztec_prv_setHashPreimage ( values : ACVMField [ ] , [ hash ] : ACVMField [ ] ) : Promise < ACVMField [ ] > {
112- this . handlerAsPrivate ( ) . storeInExecutionCache ( values . map ( Fr . fromString ) , Fr . fromString ( hash ) ) ;
131+ this . handlerAsPrivate ( ) . setHashPreimage ( values . map ( Fr . fromString ) , Fr . fromString ( hash ) ) ;
113132 return Promise . resolve ( [ ] ) ;
114133 }
115134
116135 // eslint-disable-next-line camelcase
117136 async aztec_prv_getHashPreimage ( [ returnsHash ] : ACVMField [ ] ) : Promise < ACVMField [ ] [ ] > {
118- const values = await this . handlerAsPrivate ( ) . loadFromExecutionCache ( Fr . fromString ( returnsHash ) ) ;
137+ const values = await this . handlerAsPrivate ( ) . getHashPreimage ( Fr . fromString ( returnsHash ) ) ;
119138 return [ values . map ( toACVMField ) ] ;
120139 }
121140
@@ -254,7 +273,7 @@ export class Oracle {
254273 // eslint-disable-next-line camelcase
255274 async aztec_utl_getPublicKeysAndPartialAddress ( [ address ] : ACVMField [ ] ) : Promise < ( ACVMField | ACVMField [ ] ) [ ] > {
256275 const parsedAddress = AztecAddress . fromField ( Fr . fromString ( address ) ) ;
257- const result = await this . handlerAsUtility ( ) . tryGetPublicKeysAndPartialAddress ( parsedAddress ) ;
276+ const result = await this . handlerAsUtility ( ) . getPublicKeysAndPartialAddress ( parsedAddress ) ;
258277
259278 // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
260279 // with two fields: `some` (a boolean) and `value` (a field array in this case).
@@ -381,7 +400,7 @@ export class Oracle {
381400
382401 // eslint-disable-next-line camelcase
383402 async aztec_utl_doesNullifierExist ( [ innerNullifier ] : ACVMField [ ] ) : Promise < ACVMField [ ] > {
384- const exists = await this . handlerAsUtility ( ) . checkNullifierExists ( Fr . fromString ( innerNullifier ) ) ;
403+ const exists = await this . handlerAsUtility ( ) . doesNullifierExist ( Fr . fromString ( innerNullifier ) ) ;
385404 return [ toACVMField ( exists ) ] ;
386405 }
387406
@@ -406,7 +425,7 @@ export class Oracle {
406425 [ startStorageSlot ] : ACVMField [ ] ,
407426 [ numberOfElements ] : ACVMField [ ] ,
408427 ) : Promise < ACVMField [ ] [ ] > {
409- const values = await this . handlerAsUtility ( ) . storageRead (
428+ const values = await this . handlerAsUtility ( ) . getFromPublicStorage (
410429 BlockHash . fromString ( blockHash ) ,
411430 new AztecAddress ( Fr . fromString ( contractAddress ) ) ,
412431 Fr . fromString ( startStorageSlot ) ,
@@ -465,7 +484,7 @@ export class Oracle {
465484
466485 // eslint-disable-next-line camelcase
467486 async aztec_prv_assertValidPublicCalldata ( [ calldataHash ] : ACVMField [ ] ) : Promise < ACVMField [ ] > {
468- await this . handlerAsPrivate ( ) . validatePublicCalldata ( Fr . fromString ( calldataHash ) ) ;
487+ await this . handlerAsPrivate ( ) . assertValidPublicCalldata ( Fr . fromString ( calldataHash ) ) ;
469488 return [ ] ;
470489 }
471490
@@ -477,7 +496,9 @@ export class Oracle {
477496
478497 // eslint-disable-next-line camelcase
479498 async aztec_prv_isExecutionInRevertiblePhase ( [ sideEffectCounter ] : ACVMField [ ] ) : Promise < ACVMField [ ] > {
480- const isRevertible = await this . handlerAsPrivate ( ) . inRevertiblePhase ( Fr . fromString ( sideEffectCounter ) . toNumber ( ) ) ;
499+ const isRevertible = await this . handlerAsPrivate ( ) . isExecutionInRevertiblePhase (
500+ Fr . fromString ( sideEffectCounter ) . toNumber ( ) ,
501+ ) ;
481502 return Promise . resolve ( [ toACVMField ( isRevertible ) ] ) ;
482503 }
483504
@@ -495,7 +516,7 @@ export class Oracle {
495516 [ pendingTaggedLogArrayBaseSlot ] : ACVMField [ ] ,
496517 [ scope ] : ACVMField [ ] ,
497518 ) : Promise < ACVMField [ ] > {
498- await this . handlerAsUtility ( ) . fetchTaggedLogs (
519+ await this . handlerAsUtility ( ) . getPendingTaggedLogs (
499520 Fr . fromString ( pendingTaggedLogArrayBaseSlot ) ,
500521 AztecAddress . fromString ( scope ) ,
501522 ) ;
@@ -530,7 +551,7 @@ export class Oracle {
530551 [ logRetrievalResponsesArrayBaseSlot ] : ACVMField [ ] ,
531552 [ scope ] : ACVMField [ ] ,
532553 ) : Promise < ACVMField [ ] > {
533- await this . handlerAsUtility ( ) . bulkRetrieveLogs (
554+ await this . handlerAsUtility ( ) . getLogsByTag (
534555 AztecAddress . fromString ( contractAddress ) ,
535556 Fr . fromString ( logRetrievalRequestsArrayBaseSlot ) ,
536557 Fr . fromString ( logRetrievalResponsesArrayBaseSlot ) ,
@@ -546,7 +567,7 @@ export class Oracle {
546567 [ messageContextResponsesArrayBaseSlot ] : ACVMField [ ] ,
547568 [ scope ] : ACVMField [ ] ,
548569 ) : Promise < ACVMField [ ] > {
549- await this . handlerAsUtility ( ) . utilityResolveMessageContexts (
570+ await this . handlerAsUtility ( ) . getMessageContextsByTxHash (
550571 AztecAddress . fromString ( contractAddress ) ,
551572 Fr . fromString ( messageContextRequestsArrayBaseSlot ) ,
552573 Fr . fromString ( messageContextResponsesArrayBaseSlot ) ,
@@ -562,7 +583,7 @@ export class Oracle {
562583 capsule : ACVMField [ ] ,
563584 [ scope ] : ACVMField [ ] ,
564585 ) : Promise < ACVMField [ ] > {
565- this . handlerAsUtility ( ) . storeCapsule (
586+ this . handlerAsUtility ( ) . setCapsule (
566587 AztecAddress . fromField ( Fr . fromString ( contractAddress ) ) ,
567588 Fr . fromString ( slot ) ,
568589 capsule . map ( Fr . fromString ) ,
@@ -578,7 +599,7 @@ export class Oracle {
578599 [ tSize ] : ACVMField [ ] ,
579600 [ scope ] : ACVMField [ ] ,
580601 ) : Promise < ( ACVMField | ACVMField [ ] ) [ ] > {
581- const values = await this . handlerAsUtility ( ) . loadCapsule (
602+ const values = await this . handlerAsUtility ( ) . getCapsule (
582603 AztecAddress . fromField ( Fr . fromString ( contractAddress ) ) ,
583604 Fr . fromString ( slot ) ,
584605 AztecAddress . fromField ( Fr . fromString ( scope ) ) ,
@@ -640,7 +661,7 @@ export class Oracle {
640661
641662 // Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
642663 try {
643- const plaintext = await this . handlerAsUtility ( ) . aes128Decrypt ( ciphertext , ivBuffer , symKeyBuffer ) ;
664+ const plaintext = await this . handlerAsUtility ( ) . decryptAes128 ( ciphertext , ivBuffer , symKeyBuffer ) ;
644665 const [ storage , length ] = bufferToBoundedVec ( plaintext , ciphertextBVecStorage . length ) ;
645666 return [ toACVMField ( 1 ) , storage , length ] ;
646667 } catch {
@@ -672,7 +693,7 @@ export class Oracle {
672693 [ scopeCount ] : ACVMField [ ] ,
673694 ) : Promise < ACVMField [ ] > {
674695 const scopeAddresses = scopes . slice ( 0 , + scopeCount ) . map ( s => AztecAddress . fromField ( Fr . fromString ( s ) ) ) ;
675- this . handlerAsUtility ( ) . invalidateContractSyncCache (
696+ this . handlerAsUtility ( ) . setContractSyncCacheInvalid (
676697 AztecAddress . fromField ( Fr . fromString ( contractAddress ) ) ,
677698 scopeAddresses ,
678699 ) ;
0 commit comments