Skip to content

Commit 03c2382

Browse files
authored
feat: merge-train/fairies (#21198)
BEGIN_COMMIT_OVERRIDE docs: clarifying Noir fields vs struct fields in event metadata (#21172) END_COMMIT_OVERRIDE
2 parents ec124dc + 75724e6 commit 03c2382

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import type { AbiType } from './abi.js';
22
import type { EventSelector } from './event_selector.js';
33

4+
/** Metadata for a contract event, used to decode emitted event logs back into structured data. */
45
export type EventMetadataDefinition = {
56
eventSelector: EventSelector;
67
abiType: AbiType;
8+
/** Names of the event's struct members (not serialized Noir Field elements). */
79
fieldNames: string[];
810
};

yarn-project/stdlib/src/logs/public_log.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ export class FlatPublicLogs {
120120

121121
export class PublicLog {
122122
constructor(
123-
public contractAddress: AztecAddress,
124-
public fields: Fr[],
123+
public readonly contractAddress: AztecAddress,
124+
public readonly fields: Fr[],
125125
) {}
126126

127127
static from(fields: FieldsOf<PublicLog>) {
@@ -146,7 +146,9 @@ export class PublicLog {
146146
return this.fields.length + PUBLIC_LOG_HEADER_LENGTH;
147147
}
148148

149+
/** Returns the serialized log (field as in noir field and not a struct field). */
149150
getEmittedFields() {
151+
// We slice from 0 to return a shallow copy.
150152
return this.fields.slice(0);
151153
}
152154

0 commit comments

Comments
 (0)