@aztec/pxe 3.0.0-nightly.20251125 → 3.0.0-nightly.20251127

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.
Files changed (40) hide show
  1. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -2
  2. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  3. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +9 -3
  4. package/dest/contract_function_simulator/oracle/interfaces.d.ts +3 -1
  5. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  6. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +3 -1
  7. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  8. package/dest/contract_function_simulator/oracle/note_packing_utils.js +4 -3
  9. package/dest/contract_function_simulator/oracle/oracle.d.ts +1 -1
  10. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  11. package/dest/contract_function_simulator/oracle/oracle.js +2 -2
  12. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +2 -1
  13. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +10 -2
  15. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +2 -1
  16. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/pxe_oracle_interface.js +7 -5
  18. package/dest/pxe.d.ts +3 -2
  19. package/dest/pxe.d.ts.map +1 -1
  20. package/dest/pxe.js +1 -13
  21. package/dest/storage/note_data_provider/index.d.ts +1 -1
  22. package/dest/storage/note_data_provider/index.d.ts.map +1 -1
  23. package/dest/storage/note_data_provider/index.js +1 -1
  24. package/dest/storage/note_data_provider/note_data_provider.d.ts +1 -1
  25. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  26. package/dest/storage/note_data_provider/note_data_provider.js +13 -10
  27. package/package.json +17 -17
  28. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +10 -1
  29. package/src/contract_function_simulator/oracle/interfaces.ts +10 -1
  30. package/src/contract_function_simulator/oracle/note_packing_utils.ts +5 -3
  31. package/src/contract_function_simulator/oracle/oracle.ts +2 -0
  32. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +5 -1
  33. package/src/contract_function_simulator/pxe_oracle_interface.ts +18 -12
  34. package/src/pxe.ts +4 -17
  35. package/src/storage/note_data_provider/index.ts +1 -1
  36. package/src/storage/note_data_provider/note_data_provider.ts +15 -9
  37. package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
  38. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  39. package/dest/storage/note_data_provider/note_dao.js +0 -102
  40. package/src/storage/note_data_provider/note_dao.ts +0 -154
@@ -1,154 +0,0 @@
1
- import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
2
- import { Fr, Point } from '@aztec/foundation/fields';
3
- import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import { Note } from '@aztec/stdlib/note';
6
- import { TxHash } from '@aztec/stdlib/tx';
7
-
8
- import type { NoteData } from '../../contract_function_simulator/oracle/interfaces.js';
9
-
10
- /**
11
- * A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
12
- * information required to use it during execution and manage its state.
13
- */
14
- export class NoteDao implements NoteData {
15
- constructor(
16
- // Note information
17
-
18
- /** The packed content of the note, as will be returned in the getNotes oracle. */
19
- public note: Note,
20
- /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */
21
- public contractAddress: AztecAddress,
22
- /**
23
- * The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
24
- * since contracts typically make queries based on it.
25
- */
26
- public storageSlot: Fr,
27
- /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
28
- public noteNonce: Fr,
29
-
30
- // Computed values
31
- /**
32
- * The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
33
- * be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
34
- */
35
- public noteHash: Fr,
36
- /**
37
- * The nullifier of the note, siloed by contract address.
38
- * Note: Might be set as 0 if the note was added to PXE as nullified.
39
- */
40
- public siloedNullifier: Fr,
41
-
42
- // Metadata
43
- /** The hash of the tx in which this note was created. Knowing the tx hash allows for efficient node queries e.g.
44
- * when searching for txEffects.
45
- */
46
- public txHash: TxHash,
47
- /** The L2 block number in which the tx with this note was included. Used for note management while processing
48
- * reorgs.*/
49
- public l2BlockNumber: number,
50
- /** The L2 block hash in which the tx with this note was included. Used for note management while processing
51
- * reorgs.*/
52
- public l2BlockHash: string,
53
- /** The index of the leaf in the global note hash tree the note is stored at */
54
- public index: bigint,
55
- /**
56
- * The address whose public key was used to encrypt the note log during delivery.
57
- * (This is the x-coordinate of the public key.)
58
- */
59
- public recipient: AztecAddress,
60
- ) {}
61
-
62
- toBuffer(): Buffer {
63
- return serializeToBuffer([
64
- this.note,
65
- this.contractAddress,
66
- this.storageSlot,
67
- this.noteNonce,
68
- this.noteHash,
69
- this.siloedNullifier,
70
- this.txHash,
71
- this.l2BlockNumber,
72
- Fr.fromHexString(this.l2BlockHash),
73
- this.index,
74
- this.recipient,
75
- ]);
76
- }
77
-
78
- static fromBuffer(buffer: Buffer | BufferReader) {
79
- const reader = BufferReader.asReader(buffer);
80
-
81
- const note = Note.fromBuffer(reader);
82
- const contractAddress = AztecAddress.fromBuffer(reader);
83
- const storageSlot = Fr.fromBuffer(reader);
84
- const noteNonce = Fr.fromBuffer(reader);
85
- const noteHash = Fr.fromBuffer(reader);
86
- const siloedNullifier = Fr.fromBuffer(reader);
87
- const txHash = reader.readObject(TxHash);
88
- const l2BlockNumber = reader.readNumber();
89
- const l2BlockHash = Fr.fromBuffer(reader).toString();
90
- const index = toBigIntBE(reader.readBytes(32));
91
- const recipient = AztecAddress.fromBuffer(reader);
92
-
93
- return new NoteDao(
94
- note,
95
- contractAddress,
96
- storageSlot,
97
- noteNonce,
98
- noteHash,
99
- siloedNullifier,
100
- txHash,
101
- l2BlockNumber,
102
- l2BlockHash,
103
- index,
104
- recipient,
105
- );
106
- }
107
-
108
- toString() {
109
- return '0x' + this.toBuffer().toString('hex');
110
- }
111
-
112
- static fromString(str: string) {
113
- const hex = str.replace(/^0x/, '');
114
- return NoteDao.fromBuffer(Buffer.from(hex, 'hex'));
115
- }
116
-
117
- /**
118
- * Returns the size in bytes of the Note Dao.
119
- * @returns - Its size in bytes.
120
- */
121
- public getSize() {
122
- const indexSize = Math.ceil(Math.log2(Number(this.index)));
123
- const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
124
- return noteSize + AztecAddress.SIZE_IN_BYTES + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize;
125
- }
126
-
127
- static async random({
128
- note = Note.random(),
129
- contractAddress = undefined,
130
- storageSlot = Fr.random(),
131
- noteNonce = Fr.random(),
132
- noteHash = Fr.random(),
133
- siloedNullifier = Fr.random(),
134
- txHash = TxHash.random(),
135
- l2BlockNumber = Math.floor(Math.random() * 1000),
136
- l2BlockHash = Fr.random().toString(),
137
- index = Fr.random().toBigInt(),
138
- recipient = undefined,
139
- }: Partial<NoteDao> = {}) {
140
- return new NoteDao(
141
- note,
142
- contractAddress ?? (await AztecAddress.random()),
143
- storageSlot,
144
- noteNonce,
145
- noteHash,
146
- siloedNullifier,
147
- txHash,
148
- l2BlockNumber,
149
- l2BlockHash,
150
- index,
151
- recipient ?? (await AztecAddress.random()),
152
- );
153
- }
154
- }