@aztec/stdlib 3.0.0-nightly.20251201.2 → 3.0.0-nightly.20251203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/block/in_block.d.ts +7 -5
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/l2_block.d.ts +1 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +2 -1
- package/dest/block/l2_block_source.d.ts +10 -1
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.d.ts +13 -10
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +4 -4
- package/dest/checkpoint/published_checkpoint.d.ts +5 -3
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +6 -1
- package/dest/interfaces/aztec-node.d.ts +3 -3
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/tx_provider.d.ts +3 -3
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/kernel/private_call_data.d.ts +5 -62
- package/dest/kernel/private_call_data.d.ts.map +1 -1
- package/dest/kernel/private_call_data.js +4 -105
- package/dest/messaging/l1_to_l2_message_source.d.ts +8 -1
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/note/note_dao.d.ts +6 -3
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +10 -6
- package/dest/note/notes_filter.d.ts +3 -1
- package/dest/note/notes_filter.d.ts.map +1 -1
- package/dest/note/notes_filter.js +1 -0
- package/dest/tx/indexed_tx_effect.d.ts +3 -3
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/block/in_block.ts +8 -5
- package/src/block/l2_block.ts +7 -2
- package/src/block/l2_block_source.ts +11 -0
- package/src/checkpoint/checkpoint.ts +5 -5
- package/src/interfaces/archiver.ts +9 -1
- package/src/interfaces/aztec-node.ts +2 -2
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/kernel/private_call_data.ts +3 -130
- package/src/messaging/l1_to_l2_message_source.ts +8 -0
- package/src/note/note_dao.ts +11 -2
- package/src/note/notes_filter.ts +3 -0
- package/src/tx/indexed_tx_effect.ts +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { encodeCheckpointBlobDataFromBlocks } from '@aztec/blob-lib/encoding';
|
|
2
|
+
import { CheckpointNumber, CheckpointNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { schemas } from '@aztec/foundation/schemas';
|
|
4
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
5
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ export class Checkpoint {
|
|
|
19
19
|
/** L2 blocks in the checkpoint. */
|
|
20
20
|
public blocks: L2BlockNew[],
|
|
21
21
|
/** Number of the checkpoint. */
|
|
22
|
-
public number:
|
|
22
|
+
public number: CheckpointNumber,
|
|
23
23
|
) {}
|
|
24
24
|
|
|
25
25
|
static get schema() {
|
|
@@ -28,7 +28,7 @@ export class Checkpoint {
|
|
|
28
28
|
archive: AppendOnlyTreeSnapshot.schema,
|
|
29
29
|
header: CheckpointHeader.schema,
|
|
30
30
|
blocks: z.array(L2BlockNew.schema),
|
|
31
|
-
number:
|
|
31
|
+
number: CheckpointNumberSchema,
|
|
32
32
|
})
|
|
33
33
|
.transform(({ archive, header, blocks, number }) => new Checkpoint(archive, header, blocks, number));
|
|
34
34
|
}
|
|
@@ -47,7 +47,7 @@ export class Checkpoint {
|
|
|
47
47
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
48
48
|
reader.readObject(CheckpointHeader),
|
|
49
49
|
reader.readVector(L2BlockNew),
|
|
50
|
-
reader.readNumber(),
|
|
50
|
+
CheckpointNumber(reader.readNumber()),
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -69,7 +69,7 @@ export class Checkpoint {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
static async random(
|
|
72
|
-
checkpointNumber = 1,
|
|
72
|
+
checkpointNumber = CheckpointNumber(1),
|
|
73
73
|
{
|
|
74
74
|
numBlocks = 1,
|
|
75
75
|
startBlockNumber = 1,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { L1ContractAddresses } from '@aztec/ethereum';
|
|
2
|
-
import { EpochNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { CheckpointNumberSchema, EpochNumberSchema } from '@aztec/foundation/branded-types';
|
|
3
3
|
import type { ApiSchemaFor } from '@aztec/foundation/schemas';
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -8,6 +8,8 @@ import { L2Block } from '../block/l2_block.js';
|
|
|
8
8
|
import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
|
|
9
9
|
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
10
10
|
import { ValidateBlockResultSchema } from '../block/validate_block_result.js';
|
|
11
|
+
import { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
12
|
+
import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
11
13
|
import {
|
|
12
14
|
ContractClassPublicSchema,
|
|
13
15
|
type ContractDataSource,
|
|
@@ -84,6 +86,10 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
84
86
|
.function()
|
|
85
87
|
.args(schemas.Integer, schemas.Integer, optional(z.boolean()))
|
|
86
88
|
.returns(z.array(L2Block.schema)),
|
|
89
|
+
getPublishedCheckpoints: z
|
|
90
|
+
.function()
|
|
91
|
+
.args(schemas.Integer, schemas.Integer)
|
|
92
|
+
.returns(z.array(PublishedCheckpoint.schema)),
|
|
87
93
|
getPublishedBlocks: z
|
|
88
94
|
.function()
|
|
89
95
|
.args(schemas.Integer, schemas.Integer, optional(z.boolean()))
|
|
@@ -96,6 +102,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
96
102
|
getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
|
|
97
103
|
getL2SlotNumber: z.function().args().returns(schemas.SlotNumber.optional()),
|
|
98
104
|
getL2EpochNumber: z.function().args().returns(EpochNumberSchema.optional()),
|
|
105
|
+
getCheckpointsForEpoch: z.function().args(EpochNumberSchema).returns(z.array(Checkpoint.schema)),
|
|
99
106
|
getBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(L2Block.schema)),
|
|
100
107
|
getBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
|
|
101
108
|
isEpochComplete: z.function().args(EpochNumberSchema).returns(z.boolean()),
|
|
@@ -115,6 +122,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
115
122
|
.returns(ContractInstanceWithAddressSchema.optional()),
|
|
116
123
|
getContractClassIds: z.function().args().returns(z.array(schemas.Fr)),
|
|
117
124
|
registerContractFunctionSignatures: z.function().args(z.array(z.string())).returns(z.void()),
|
|
125
|
+
getL1ToL2MessagesForCheckpoint: z.function().args(CheckpointNumberSchema).returns(z.array(schemas.Fr)),
|
|
118
126
|
getL1ToL2Messages: z.function().args(schemas.Integer).returns(z.array(schemas.Fr)),
|
|
119
127
|
getL1ToL2MessageIndex: z.function().args(schemas.Fr).returns(schemas.BigInt.optional()),
|
|
120
128
|
getDebugFunctionName: z.function().args(schemas.AztecAddress, schemas.FunctionSelector).returns(optional(z.string())),
|
|
@@ -16,7 +16,7 @@ import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
|
|
|
16
16
|
import { z } from 'zod';
|
|
17
17
|
|
|
18
18
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
19
|
-
import { type
|
|
19
|
+
import { type DataInBlock, inBlockSchemaFor } from '../block/in_block.js';
|
|
20
20
|
import { L2Block } from '../block/l2_block.js';
|
|
21
21
|
import { type L2BlockNumber, L2BlockNumberSchema } from '../block/l2_block_number.js';
|
|
22
22
|
import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
@@ -91,7 +91,7 @@ export interface AztecNode
|
|
|
91
91
|
blockNumber: L2BlockNumber,
|
|
92
92
|
treeId: MerkleTreeId,
|
|
93
93
|
leafValues: Fr[],
|
|
94
|
-
): Promise<(
|
|
94
|
+
): Promise<(DataInBlock<bigint> | undefined)[]>;
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* Returns a sibling path for the given index in the nullifier tree.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { L2BlockNew } from '@aztec/stdlib/block';
|
|
2
2
|
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
3
3
|
import { type Tx, TxHash } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
@@ -13,5 +13,5 @@ export interface ITxProvider {
|
|
|
13
13
|
opts: { pinnedPeer: PeerId | undefined; deadline: Date },
|
|
14
14
|
): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
|
|
15
15
|
|
|
16
|
-
getTxsForBlock(block:
|
|
16
|
+
getTxsForBlock(block: L2BlockNew, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
|
|
17
17
|
}
|
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FUNCTION_TREE_HEIGHT,
|
|
3
|
-
MAX_CONTRACT_CLASS_LOGS_PER_CALL,
|
|
4
|
-
MAX_ENQUEUED_CALLS_PER_CALL,
|
|
5
|
-
MAX_L2_TO_L1_MSGS_PER_CALL,
|
|
6
|
-
MAX_NOTE_HASHES_PER_CALL,
|
|
7
|
-
MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
|
|
8
|
-
MAX_NULLIFIERS_PER_CALL,
|
|
9
|
-
MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
|
|
10
|
-
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
|
|
11
|
-
MAX_PRIVATE_LOGS_PER_CALL,
|
|
12
|
-
PUBLIC_DATA_TREE_HEIGHT,
|
|
13
|
-
TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL,
|
|
14
|
-
UPDATES_VALUE_SIZE,
|
|
15
|
-
} from '@aztec/constants';
|
|
1
|
+
import { FUNCTION_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, UPDATES_VALUE_SIZE } from '@aztec/constants';
|
|
16
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
17
|
-
import { BufferReader,
|
|
3
|
+
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
18
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
19
5
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
20
6
|
|
|
21
7
|
import { DelayedPublicMutableValues } from '../delayed_public_mutable/delayed_public_mutable_values.js';
|
|
22
8
|
import { PublicKeys } from '../keys/public_keys.js';
|
|
23
9
|
import { PublicDataTreeLeafPreimage } from '../trees/index.js';
|
|
24
|
-
import type { UInt32 } from '../types/shared.js';
|
|
25
10
|
import { VerificationKeyAsFields } from '../vks/verification_key.js';
|
|
26
11
|
import { PrivateCircuitPublicInputs } from './private_circuit_public_inputs.js';
|
|
27
12
|
|
|
@@ -44,11 +29,6 @@ export class PrivateCallData {
|
|
|
44
29
|
* Hints for the validation of the vk
|
|
45
30
|
*/
|
|
46
31
|
public verificationKeyHints: PrivateVerificationKeyHints,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Hints for validating the uniqueness of the side effects.
|
|
50
|
-
*/
|
|
51
|
-
public sideEffectUniquenessHints: SideEffectUniquenessHints,
|
|
52
32
|
) {}
|
|
53
33
|
|
|
54
34
|
/**
|
|
@@ -57,7 +37,7 @@ export class PrivateCallData {
|
|
|
57
37
|
* @returns The array.
|
|
58
38
|
*/
|
|
59
39
|
static getFields(fields: FieldsOf<PrivateCallData>) {
|
|
60
|
-
return [fields.publicInputs, fields.vk, fields.verificationKeyHints
|
|
40
|
+
return [fields.publicInputs, fields.vk, fields.verificationKeyHints] as const;
|
|
61
41
|
}
|
|
62
42
|
|
|
63
43
|
static from(fields: FieldsOf<PrivateCallData>): PrivateCallData {
|
|
@@ -83,7 +63,6 @@ export class PrivateCallData {
|
|
|
83
63
|
reader.readObject(PrivateCircuitPublicInputs),
|
|
84
64
|
reader.readObject(VerificationKeyAsFields),
|
|
85
65
|
reader.readObject(PrivateVerificationKeyHints),
|
|
86
|
-
reader.readObject(SideEffectUniquenessHints),
|
|
87
66
|
);
|
|
88
67
|
}
|
|
89
68
|
}
|
|
@@ -201,109 +180,3 @@ export class UpdatedClassIdHints {
|
|
|
201
180
|
);
|
|
202
181
|
}
|
|
203
182
|
}
|
|
204
|
-
|
|
205
|
-
export class SideEffectUniquenessHints {
|
|
206
|
-
constructor(
|
|
207
|
-
public sideEffectRanges: Tuple<SideEffectCounterRange, typeof TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL>,
|
|
208
|
-
public noteHashReadRequestIndices: Tuple<UInt32, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_CALL>,
|
|
209
|
-
public nullifierReadRequestIndices: Tuple<UInt32, typeof MAX_NULLIFIER_READ_REQUESTS_PER_CALL>,
|
|
210
|
-
public noteHashesIndices: Tuple<UInt32, typeof MAX_NOTE_HASHES_PER_CALL>,
|
|
211
|
-
public nullifiersIndices: Tuple<UInt32, typeof MAX_NULLIFIERS_PER_CALL>,
|
|
212
|
-
public privateCallRequestsIndices: Tuple<UInt32, typeof MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL>,
|
|
213
|
-
public publicCallRequestsIndices: Tuple<UInt32, typeof MAX_ENQUEUED_CALLS_PER_CALL>,
|
|
214
|
-
public l2ToL1MsgsIndices: Tuple<UInt32, typeof MAX_L2_TO_L1_MSGS_PER_CALL>,
|
|
215
|
-
public privateLogsIndices: Tuple<UInt32, typeof MAX_PRIVATE_LOGS_PER_CALL>,
|
|
216
|
-
public contractClassLogsHashesIndices: Tuple<UInt32, typeof MAX_CONTRACT_CLASS_LOGS_PER_CALL>,
|
|
217
|
-
) {}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Serialize into a field array. Low-level utility.
|
|
221
|
-
* @param fields - Object with fields.
|
|
222
|
-
* @returns The array.
|
|
223
|
-
*/
|
|
224
|
-
static getFields(fields: FieldsOf<SideEffectUniquenessHints>) {
|
|
225
|
-
return [
|
|
226
|
-
fields.sideEffectRanges,
|
|
227
|
-
fields.noteHashReadRequestIndices,
|
|
228
|
-
fields.nullifierReadRequestIndices,
|
|
229
|
-
fields.noteHashesIndices,
|
|
230
|
-
fields.nullifiersIndices,
|
|
231
|
-
fields.privateCallRequestsIndices,
|
|
232
|
-
fields.publicCallRequestsIndices,
|
|
233
|
-
fields.l2ToL1MsgsIndices,
|
|
234
|
-
fields.privateLogsIndices,
|
|
235
|
-
fields.contractClassLogsHashesIndices,
|
|
236
|
-
] as const;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
static from(fields: FieldsOf<SideEffectUniquenessHints>): SideEffectUniquenessHints {
|
|
240
|
-
return new SideEffectUniquenessHints(...SideEffectUniquenessHints.getFields(fields));
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Serialize this as a buffer.
|
|
245
|
-
* @returns The buffer.
|
|
246
|
-
*/
|
|
247
|
-
toBuffer(): Buffer {
|
|
248
|
-
return serializeToBuffer(...SideEffectUniquenessHints.getFields(this));
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Deserializes from a buffer or reader.
|
|
253
|
-
* @param buffer - Buffer or reader to read from.
|
|
254
|
-
* @returns The deserialized instance.
|
|
255
|
-
*/
|
|
256
|
-
static fromBuffer(buffer: Buffer | BufferReader): SideEffectUniquenessHints {
|
|
257
|
-
const reader = BufferReader.asReader(buffer);
|
|
258
|
-
return new SideEffectUniquenessHints(
|
|
259
|
-
reader.readArray(TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL, SideEffectCounterRange),
|
|
260
|
-
reader.readNumbers(MAX_NOTE_HASH_READ_REQUESTS_PER_CALL),
|
|
261
|
-
reader.readNumbers(MAX_NULLIFIER_READ_REQUESTS_PER_CALL),
|
|
262
|
-
reader.readNumbers(MAX_NOTE_HASHES_PER_CALL),
|
|
263
|
-
reader.readNumbers(MAX_NULLIFIERS_PER_CALL),
|
|
264
|
-
reader.readNumbers(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL),
|
|
265
|
-
reader.readNumbers(MAX_ENQUEUED_CALLS_PER_CALL),
|
|
266
|
-
reader.readNumbers(MAX_L2_TO_L1_MSGS_PER_CALL),
|
|
267
|
-
reader.readNumbers(MAX_PRIVATE_LOGS_PER_CALL),
|
|
268
|
-
reader.readNumbers(MAX_CONTRACT_CLASS_LOGS_PER_CALL),
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export class SideEffectCounterRange {
|
|
274
|
-
constructor(
|
|
275
|
-
public start: UInt32,
|
|
276
|
-
public end: UInt32,
|
|
277
|
-
public sideEffectGlobalIndex: UInt32,
|
|
278
|
-
) {}
|
|
279
|
-
|
|
280
|
-
static getFields(fields: FieldsOf<SideEffectCounterRange>) {
|
|
281
|
-
return [fields.start, fields.end, fields.sideEffectGlobalIndex] as const;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
static from(fields: FieldsOf<SideEffectCounterRange>): SideEffectCounterRange {
|
|
285
|
-
return new SideEffectCounterRange(...SideEffectCounterRange.getFields(fields));
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
static empty(): SideEffectCounterRange {
|
|
289
|
-
return new SideEffectCounterRange(0, 0, 0);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Serialize this as a buffer.
|
|
294
|
-
* @returns The buffer.
|
|
295
|
-
*/
|
|
296
|
-
toBuffer(): Buffer {
|
|
297
|
-
return serializeToBuffer(...SideEffectCounterRange.getFields(this));
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Deserializes from a buffer or reader.
|
|
302
|
-
* @param buffer - Buffer or reader to read from.
|
|
303
|
-
* @returns The deserialized instance.
|
|
304
|
-
*/
|
|
305
|
-
static fromBuffer(buffer: Buffer | BufferReader): SideEffectCounterRange {
|
|
306
|
-
const reader = BufferReader.asReader(buffer);
|
|
307
|
-
return new SideEffectCounterRange(reader.readNumber(), reader.readNumber(), reader.readNumber());
|
|
308
|
-
}
|
|
309
|
-
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
|
|
3
4
|
import type { L2Tips } from '../block/l2_block_source.js';
|
|
@@ -6,6 +7,13 @@ import type { L2Tips } from '../block/l2_block_source.js';
|
|
|
6
7
|
* Interface of classes allowing for the retrieval of L1 to L2 messages.
|
|
7
8
|
*/
|
|
8
9
|
export interface L1ToL2MessageSource {
|
|
10
|
+
/**
|
|
11
|
+
* Gets new L1 to L2 message (to be) included in a given checkpoint.
|
|
12
|
+
* @param checkpointNumber - Checkpoint number to get messages for.
|
|
13
|
+
* @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
|
|
14
|
+
*/
|
|
15
|
+
getL1ToL2MessagesForCheckpoint(checkpointNumber: CheckpointNumber): Promise<Fr[]>;
|
|
16
|
+
|
|
9
17
|
/**
|
|
10
18
|
* Gets new L1 to L2 message (to be) included in a given block.
|
|
11
19
|
* @param blockNumber - L2 block number to get messages for.
|
package/src/note/note_dao.ts
CHANGED
|
@@ -17,13 +17,15 @@ export class NoteDao {
|
|
|
17
17
|
public note: Note,
|
|
18
18
|
/** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */
|
|
19
19
|
public contractAddress: AztecAddress,
|
|
20
|
+
/** The owner of the note - generally the account that can spend the note. */
|
|
21
|
+
public owner: AztecAddress,
|
|
20
22
|
/**
|
|
21
23
|
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
22
24
|
* since contracts typically make queries based on it.
|
|
23
25
|
*/
|
|
24
26
|
public storageSlot: Fr,
|
|
25
27
|
/**
|
|
26
|
-
* The randomness injected to the note.
|
|
28
|
+
* The randomness injected to the note hash preimage.
|
|
27
29
|
*/
|
|
28
30
|
public randomness: Fr,
|
|
29
31
|
/** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
|
|
@@ -60,6 +62,7 @@ export class NoteDao {
|
|
|
60
62
|
return serializeToBuffer([
|
|
61
63
|
this.note,
|
|
62
64
|
this.contractAddress,
|
|
65
|
+
this.owner,
|
|
63
66
|
this.storageSlot,
|
|
64
67
|
this.randomness,
|
|
65
68
|
this.noteNonce,
|
|
@@ -77,6 +80,7 @@ export class NoteDao {
|
|
|
77
80
|
|
|
78
81
|
const note = Note.fromBuffer(reader);
|
|
79
82
|
const contractAddress = AztecAddress.fromBuffer(reader);
|
|
83
|
+
const owner = AztecAddress.fromBuffer(reader);
|
|
80
84
|
const storageSlot = Fr.fromBuffer(reader);
|
|
81
85
|
const randomness = Fr.fromBuffer(reader);
|
|
82
86
|
const noteNonce = Fr.fromBuffer(reader);
|
|
@@ -90,6 +94,7 @@ export class NoteDao {
|
|
|
90
94
|
return new NoteDao(
|
|
91
95
|
note,
|
|
92
96
|
contractAddress,
|
|
97
|
+
owner,
|
|
93
98
|
storageSlot,
|
|
94
99
|
randomness,
|
|
95
100
|
noteNonce,
|
|
@@ -118,12 +123,15 @@ export class NoteDao {
|
|
|
118
123
|
public getSize() {
|
|
119
124
|
const indexSize = Math.ceil(Math.log2(Number(this.index)));
|
|
120
125
|
const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
|
|
121
|
-
return
|
|
126
|
+
return (
|
|
127
|
+
noteSize + AztecAddress.SIZE_IN_BYTES * 2 + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize
|
|
128
|
+
);
|
|
122
129
|
}
|
|
123
130
|
|
|
124
131
|
static async random({
|
|
125
132
|
note = Note.random(),
|
|
126
133
|
contractAddress = undefined,
|
|
134
|
+
owner = undefined,
|
|
127
135
|
storageSlot = Fr.random(),
|
|
128
136
|
randomness = Fr.random(),
|
|
129
137
|
noteNonce = Fr.random(),
|
|
@@ -137,6 +145,7 @@ export class NoteDao {
|
|
|
137
145
|
return new NoteDao(
|
|
138
146
|
note,
|
|
139
147
|
contractAddress ?? (await AztecAddress.random()),
|
|
148
|
+
owner ?? (await AztecAddress.random()),
|
|
140
149
|
storageSlot,
|
|
141
150
|
randomness,
|
|
142
151
|
noteNonce,
|
package/src/note/notes_filter.ts
CHANGED
|
@@ -16,6 +16,8 @@ export type NotesFilter = {
|
|
|
16
16
|
* @remarks Providing a contract address is required as we need that information to trigger private state sync.
|
|
17
17
|
*/
|
|
18
18
|
contractAddress: AztecAddress;
|
|
19
|
+
/** The owner of the note. */
|
|
20
|
+
owner?: AztecAddress;
|
|
19
21
|
/** The specific storage location of the note on the contract. */
|
|
20
22
|
storageSlot?: Fr;
|
|
21
23
|
/** The status of the note. Defaults to 'ACTIVE'. */
|
|
@@ -28,6 +30,7 @@ export type NotesFilter = {
|
|
|
28
30
|
|
|
29
31
|
export const NotesFilterSchema: ZodFor<NotesFilter> = z.object({
|
|
30
32
|
contractAddress: schemas.AztecAddress,
|
|
33
|
+
owner: schemas.AztecAddress.optional(),
|
|
31
34
|
storageSlot: schemas.Fr.optional(),
|
|
32
35
|
status: z.nativeEnum(NoteStatus).optional(),
|
|
33
36
|
siloedNullifier: schemas.Fr.optional(),
|
|
@@ -2,10 +2,10 @@ import { schemas } from '@aztec/foundation/schemas';
|
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
3
|
|
|
4
4
|
import { L2BlockHash } from '../block/block_hash.js';
|
|
5
|
-
import { type
|
|
5
|
+
import { type DataInBlock, inBlockSchemaFor, randomInBlock } from '../block/in_block.js';
|
|
6
6
|
import { TxEffect } from './tx_effect.js';
|
|
7
7
|
|
|
8
|
-
export type IndexedTxEffect =
|
|
8
|
+
export type IndexedTxEffect = DataInBlock<TxEffect> & { txIndexInBlock: number };
|
|
9
9
|
|
|
10
10
|
export function indexedTxSchema() {
|
|
11
11
|
return inBlockSchemaFor(TxEffect.schema).extend({ txIndexInBlock: schemas.Integer });
|