@@ -15,6 +15,7 @@ import {
1515import { BlockNumber } from '@aztec/foundation/branded-types' ;
1616import { padArrayEnd } from '@aztec/foundation/collection' ;
1717import { Fr } from '@aztec/foundation/curves/bn254' ;
18+ import { Point } from '@aztec/foundation/curves/grumpkin' ;
1819import { FieldReader } from '@aztec/foundation/serialize' ;
1920import { MembershipWitness } from '@aztec/foundation/trees' ;
2021import { type ACVMField , fromUintArray , toACVMField } from '@aztec/simulator/client' ;
@@ -25,18 +26,31 @@ import { BlockHash } from '@aztec/stdlib/block';
2526import type { ContractInstance , PartialAddress } from '@aztec/stdlib/contract' ;
2627import { KeyValidationRequest } from '@aztec/stdlib/kernel' ;
2728import type { PublicKeys } from '@aztec/stdlib/keys' ;
28- import { ContractClassLog , ContractClassLogFields , FlatPublicLogs , PrivateLog , Tag } from '@aztec/stdlib/logs' ;
29+ import {
30+ ContractClassLog ,
31+ ContractClassLogFields ,
32+ FlatPublicLogs ,
33+ MessageContext ,
34+ PendingTaggedLog ,
35+ PrivateLog ,
36+ Tag ,
37+ } from '@aztec/stdlib/logs' ;
2938import { NullifierMembershipWitness , PublicDataWitness } from '@aztec/stdlib/trees' ;
3039import { BlockHeader , TxEffect , TxHash } from '@aztec/stdlib/tx' ;
3140
3241import { BoundedVec } from '../noir-structs/bounded_vec.js' ;
42+ import { EphemeralArray } from '../noir-structs/ephemeral_array.js' ;
43+ import { EventValidationRequest } from '../noir-structs/event_validation_request.js' ;
44+ import { LogRetrievalRequest } from '../noir-structs/log_retrieval_request.js' ;
45+ import { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js' ;
46+ import { NoteValidationRequest } from '../noir-structs/note_validation_request.js' ;
3347import { Option } from '../noir-structs/option.js' ;
3448import { UtilityContext } from '../noir-structs/utility_context.js' ;
3549import type { NoteData } from './interfaces.js' ;
3650import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js' ;
3751import { packAsHintedNote } from './note_packing_utils.js' ;
3852
39- const FIELD : TypeMapping < Fr > = {
53+ export const FIELD : TypeMapping < Fr > = {
4054 serialization : { fn : v => [ v ] } ,
4155 deserialization : { fn : ( [ reader ] ) => reader . readField ( ) , slots : 1 } ,
4256} ;
@@ -254,6 +268,48 @@ const NOTE: TypeMapping<NoteData> = {
254268 } ,
255269} ;
256270
271+ export const POINT : TypeMapping < Point > = {
272+ serialization : { fn : p => [ p . toFields ( ) ] } ,
273+ deserialization : {
274+ fn : ( [ reader ] ) => Point . fromFields ( [ reader . readField ( ) , reader . readField ( ) ] ) ,
275+ slots : 1 ,
276+ } ,
277+ } ;
278+
279+ export const PENDING_TAGGED_LOG : TypeMapping < PendingTaggedLog > = {
280+ serialization : { fn : log => [ log . toFields ( ) ] } ,
281+ } ;
282+
283+ export const NOTE_VALIDATION_REQUEST : TypeMapping < NoteValidationRequest > = {
284+ deserialization : {
285+ fn : ( [ reader ] ) => NoteValidationRequest . fromFields ( reader ) ,
286+ slots : 1 ,
287+ } ,
288+ } ;
289+
290+ export const EVENT_VALIDATION_REQUEST : TypeMapping < EventValidationRequest > = {
291+ deserialization : {
292+ fn : ( [ reader ] ) => EventValidationRequest . fromFields ( reader ) ,
293+ slots : 1 ,
294+ } ,
295+ } ;
296+
297+ export const LOG_RETRIEVAL_REQUEST : TypeMapping < LogRetrievalRequest > = {
298+ serialization : { fn : req => [ req . toFields ( ) ] } ,
299+ deserialization : {
300+ fn : ( [ reader ] ) => LogRetrievalRequest . fromFields ( reader ) ,
301+ slots : 1 ,
302+ } ,
303+ } ;
304+
305+ export const LOG_RETRIEVAL_RESPONSE : TypeMapping < LogRetrievalResponse > = {
306+ serialization : { fn : resp => [ resp . toFields ( ) ] } ,
307+ } ;
308+
309+ export const MESSAGE_CONTEXT : TypeMapping < MessageContext > = {
310+ serialization : { fn : mc => [ mc . toFields ( ) ] } ,
311+ } ;
312+
257313const ORACLE_REGISTRY = {
258314 aztec_utl_assertCompatibleOracleVersion : makeEntry ( {
259315 params : [
@@ -389,25 +445,25 @@ const ORACLE_REGISTRY = {
389445
390446 aztec_utl_getPendingTaggedLogs : makeEntry ( {
391447 params : [ { name : 'scope' , type : AZTEC_ADDRESS } ] ,
392- returnType : FIELD ,
448+ returnType : EPHEMERAL_ARRAY ( PENDING_TAGGED_LOG ) ,
393449 } ) ,
394450
395451 aztec_utl_validateAndStoreEnqueuedNotesAndEvents : makeEntry ( {
396452 params : [
397- { name : 'noteValidationRequestsArrayBaseSlot ' , type : FIELD } ,
398- { name : 'eventValidationRequestsArrayBaseSlot ' , type : FIELD } ,
453+ { name : 'noteValidationRequests ' , type : EPHEMERAL_ARRAY ( NOTE_VALIDATION_REQUEST ) } ,
454+ { name : 'eventValidationRequests ' , type : EPHEMERAL_ARRAY ( EVENT_VALIDATION_REQUEST ) } ,
399455 { name : 'scope' , type : AZTEC_ADDRESS } ,
400456 ] ,
401457 } ) ,
402458
403459 aztec_utl_getLogsByTag : makeEntry ( {
404- params : [ { name : 'requestArrayBaseSlot ' , type : FIELD } ] ,
405- returnType : FIELD ,
460+ params : [ { name : 'requests ' , type : EPHEMERAL_ARRAY ( LOG_RETRIEVAL_REQUEST ) } ] ,
461+ returnType : EPHEMERAL_ARRAY ( EPHEMERAL_ARRAY ( LOG_RETRIEVAL_RESPONSE ) ) ,
406462 } ) ,
407463
408464 aztec_utl_getMessageContextsByTxHash : makeEntry ( {
409- params : [ { name : 'requestArrayBaseSlot ' , type : FIELD } ] ,
410- returnType : FIELD ,
465+ params : [ { name : 'requests ' , type : EPHEMERAL_ARRAY ( FIELD ) } ] ,
466+ returnType : EPHEMERAL_ARRAY ( OPTION ( MESSAGE_CONTEXT ) ) ,
411467 } ) ,
412468
413469 aztec_utl_getTxEffect : makeEntry ( {
@@ -464,10 +520,10 @@ const ORACLE_REGISTRY = {
464520 aztec_utl_getSharedSecrets : makeEntry ( {
465521 params : [
466522 { name : 'address' , type : AZTEC_ADDRESS } ,
467- { name : 'ephPksSlot ' , type : FIELD } ,
523+ { name : 'ephPks ' , type : EPHEMERAL_ARRAY ( POINT ) } ,
468524 { name : 'contractAddress' , type : AZTEC_ADDRESS } ,
469525 ] ,
470- returnType : FIELD ,
526+ returnType : EPHEMERAL_ARRAY ( FIELD ) ,
471527 } ) ,
472528
473529 aztec_utl_setContractSyncCacheInvalid : makeEntry ( {
@@ -820,7 +876,7 @@ function BOUNDED_VEC<T>(element: TypeMapping<T>): TypeMapping<BoundedVec<T>> {
820876 * slot 1: Fr(0) // zero-filled using shape
821877 * ```
822878 */
823- function OPTION < T > ( inner : TypeMapping < T > ) : TypeMapping < Option < T > > {
879+ export function OPTION < T > ( inner : TypeMapping < T > ) : TypeMapping < Option < T > > {
824880 return {
825881 serialization : inner . serialization
826882 ? {
@@ -870,6 +926,17 @@ function BUFFER(bitSize: number): TypeMapping<Buffer> {
870926 } ;
871927}
872928
929+ export function EPHEMERAL_ARRAY < T > ( element : TypeMapping < T > ) : TypeMapping < EphemeralArray < T > > {
930+ return {
931+ serialization : element . serialization
932+ ? { fn : ea => [ ea . materializeSlot ( v => element . serialization ! . fn ( v ) . flat ( ) as Fr [ ] ) ] }
933+ : undefined ,
934+ deserialization : element . deserialization
935+ ? { fn : ( [ reader ] ) => EphemeralArray . fromSlot ( reader . readField ( ) , element ) , slots : 1 }
936+ : undefined ,
937+ } ;
938+ }
939+
873940/** A named oracle parameter with its TypeMapping. */
874941interface RegistryParam < TName extends string = string , T = any > {
875942 name : TName ;
0 commit comments