@aztec/stdlib 3.0.0-nightly.20251124 → 3.0.0-nightly.20251126
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/note/unique_note.d.ts +0 -4
- package/dest/note/unique_note.d.ts.map +1 -1
- package/dest/note/unique_note.js +5 -10
- package/dest/p2p/gossipable.d.ts +4 -3
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/gossipable.js +15 -9
- package/dest/tests/mocks.d.ts +1 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +2 -2
- package/dest/tx/private_execution_result.d.ts +8 -0
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +6 -3
- package/dest/tx/tx.d.ts +2 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +3 -2
- package/package.json +8 -8
- package/src/note/unique_note.ts +5 -23
- package/src/p2p/gossipable.ts +16 -7
- package/src/tests/mocks.ts +1 -9
- package/src/tx/private_execution_result.ts +5 -2
- package/src/tx/tx.ts +3 -2
|
@@ -10,8 +10,6 @@ import { Note } from './note.js';
|
|
|
10
10
|
export declare class UniqueNote {
|
|
11
11
|
/** The note as emitted from the Noir contract. */
|
|
12
12
|
note: Note;
|
|
13
|
-
/** The recipient whose public key was used to encrypt the note. */
|
|
14
|
-
recipient: AztecAddress;
|
|
15
13
|
/** The contract address this note is created in. */
|
|
16
14
|
contractAddress: AztecAddress;
|
|
17
15
|
/** The specific storage location of the note on the contract. */
|
|
@@ -23,8 +21,6 @@ export declare class UniqueNote {
|
|
|
23
21
|
constructor(
|
|
24
22
|
/** The note as emitted from the Noir contract. */
|
|
25
23
|
note: Note,
|
|
26
|
-
/** The recipient whose public key was used to encrypt the note. */
|
|
27
|
-
recipient: AztecAddress,
|
|
28
24
|
/** The contract address this note is created in. */
|
|
29
25
|
contractAddress: AztecAddress,
|
|
30
26
|
/** The specific storage location of the note on the contract. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unique_note.d.ts","sourceRoot":"","sources":["../../src/note/unique_note.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAK9E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,qBAAa,UAAU;IAEnB,kDAAkD;IAC3C,IAAI,EAAE,IAAI;IACjB,
|
|
1
|
+
{"version":3,"file":"unique_note.d.ts","sourceRoot":"","sources":["../../src/note/unique_note.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAK9E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,qBAAa,UAAU;IAEnB,kDAAkD;IAC3C,IAAI,EAAE,IAAI;IACjB,oDAAoD;IAC7C,eAAe,EAAE,YAAY;IACpC,iEAAiE;IAC1D,WAAW,EAAE,EAAE;IACtB,kDAAkD;IAC3C,MAAM,EAAE,MAAM;IACrB,gGAAgG;IACzF,SAAS,EAAE,EAAE;;IATpB,kDAAkD;IAC3C,IAAI,EAAE,IAAI;IACjB,oDAAoD;IAC7C,eAAe,EAAE,YAAY;IACpC,iEAAiE;IAC1D,WAAW,EAAE,EAAE;IACtB,kDAAkD;IAC3C,MAAM,EAAE,MAAM;IACrB,gGAAgG;IACzF,SAAS,EAAE,EAAE;IAGtB,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,CAYtC;IAED,QAAQ,IAAI,MAAM;WAIL,MAAM;IAInB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAY/C,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,QAAQ;CAGT"}
|
package/dest/note/unique_note.js
CHANGED
|
@@ -10,14 +10,12 @@ import { Note } from './note.js';
|
|
|
10
10
|
* A note with contextual data and a nonce that makes it unique.
|
|
11
11
|
*/ export class UniqueNote {
|
|
12
12
|
note;
|
|
13
|
-
recipient;
|
|
14
13
|
contractAddress;
|
|
15
14
|
storageSlot;
|
|
16
15
|
txHash;
|
|
17
16
|
noteNonce;
|
|
18
|
-
constructor(/** The note as emitted from the Noir contract. */ note, /** The
|
|
17
|
+
constructor(/** The note as emitted from the Noir contract. */ note, /** The contract address this note is created in. */ contractAddress, /** The specific storage location of the note on the contract. */ storageSlot, /** The hash of the tx the note was created in. */ txHash, /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */ noteNonce){
|
|
19
18
|
this.note = note;
|
|
20
|
-
this.recipient = recipient;
|
|
21
19
|
this.contractAddress = contractAddress;
|
|
22
20
|
this.storageSlot = storageSlot;
|
|
23
21
|
this.txHash = txHash;
|
|
@@ -26,19 +24,17 @@ import { Note } from './note.js';
|
|
|
26
24
|
static get schema() {
|
|
27
25
|
return z.object({
|
|
28
26
|
note: Note.schema,
|
|
29
|
-
recipient: schemas.AztecAddress,
|
|
30
27
|
contractAddress: schemas.AztecAddress,
|
|
31
28
|
storageSlot: schemas.Fr,
|
|
32
29
|
txHash: TxHash.schema,
|
|
33
30
|
noteNonce: schemas.Fr
|
|
34
|
-
}).transform(({ note,
|
|
35
|
-
return new UniqueNote(note,
|
|
31
|
+
}).transform(({ note, contractAddress, storageSlot, txHash, noteNonce })=>{
|
|
32
|
+
return new UniqueNote(note, contractAddress, storageSlot, txHash, noteNonce);
|
|
36
33
|
});
|
|
37
34
|
}
|
|
38
35
|
toBuffer() {
|
|
39
36
|
return serializeToBuffer([
|
|
40
37
|
this.note,
|
|
41
|
-
this.recipient,
|
|
42
38
|
this.contractAddress,
|
|
43
39
|
this.storageSlot,
|
|
44
40
|
this.txHash,
|
|
@@ -46,17 +42,16 @@ import { Note } from './note.js';
|
|
|
46
42
|
]);
|
|
47
43
|
}
|
|
48
44
|
static async random() {
|
|
49
|
-
return new UniqueNote(Note.random(), await AztecAddress.random(),
|
|
45
|
+
return new UniqueNote(Note.random(), await AztecAddress.random(), Fr.random(), TxHash.random(), Fr.random());
|
|
50
46
|
}
|
|
51
47
|
static fromBuffer(buffer) {
|
|
52
48
|
const reader = BufferReader.asReader(buffer);
|
|
53
49
|
const note = reader.readObject(Note);
|
|
54
|
-
const recipient = reader.readObject(AztecAddress);
|
|
55
50
|
const contractAddress = reader.readObject(AztecAddress);
|
|
56
51
|
const storageSlot = reader.readObject(Fr);
|
|
57
52
|
const txHash = reader.readObject(TxHash);
|
|
58
53
|
const noteNonce = reader.readObject(Fr);
|
|
59
|
-
return new UniqueNote(note,
|
|
54
|
+
return new UniqueNote(note, contractAddress, storageSlot, txHash, noteNonce);
|
|
60
55
|
}
|
|
61
56
|
static fromString(str) {
|
|
62
57
|
return UniqueNote.fromBuffer(hexToBuffer(str));
|
package/dest/p2p/gossipable.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { Buffer32 } from '@aztec/foundation/buffer';
|
|
|
2
2
|
import type { TopicType } from './topic_type.js';
|
|
3
3
|
export declare class P2PMessage {
|
|
4
4
|
readonly payload: Buffer;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
static
|
|
5
|
+
readonly timestamp?: Date | undefined;
|
|
6
|
+
constructor(payload: Buffer, timestamp?: Date | undefined);
|
|
7
|
+
static fromGossipable(message: Gossipable, instrumentMessages?: boolean): P2PMessage;
|
|
8
|
+
static fromMessageData(messageData: Buffer, instrumentMessages?: boolean): P2PMessage;
|
|
8
9
|
toMessageData(): Buffer;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gossipable.d.ts","sourceRoot":"","sources":["../../src/p2p/gossipable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"gossipable.d.ts","sourceRoot":"","sources":["../../src/p2p/gossipable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAAa,UAAU;aAEH,OAAO,EAAE,MAAM;aACf,SAAS,CAAC,EAAE,IAAI;gBADhB,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,IAAI,YAAA;IAGlC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,kBAAkB,UAAQ,GAAG,UAAU;IAIlF,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,UAAQ,GAAG,UAAU;IAOnF,aAAa,IAAI,MAAM;CAQxB;AAED;;;;GAIG;AACH,8BAAsB,UAAU;IAC9B,OAAO,CAAC,QAAQ,CAAuB;IACvC,2EAA2E;IAC3E,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE3B;;;OAGG;IACG,2BAA2B,IAAI,OAAO,CAAC,QAAQ,CAAC;IAQtD,QAAQ,CAAC,4BAA4B,IAAI,OAAO,CAAC,QAAQ,CAAC;IAE1D,QAAQ,CAAC,QAAQ,IAAI,MAAM;IAE3B,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,MAAM;CAC3B"}
|
package/dest/p2p/gossipable.js
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
1
|
+
import { BufferReader, bigintToUInt64BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
2
2
|
export class P2PMessage {
|
|
3
3
|
payload;
|
|
4
|
-
|
|
4
|
+
timestamp;
|
|
5
|
+
constructor(payload, timestamp){
|
|
5
6
|
this.payload = payload;
|
|
7
|
+
this.timestamp = timestamp;
|
|
6
8
|
}
|
|
7
|
-
static fromGossipable(message) {
|
|
8
|
-
return new P2PMessage(message.toBuffer());
|
|
9
|
+
static fromGossipable(message, instrumentMessages = false) {
|
|
10
|
+
return new P2PMessage(message.toBuffer(), instrumentMessages ? new Date() : undefined);
|
|
9
11
|
}
|
|
10
|
-
static fromMessageData(messageData) {
|
|
12
|
+
static fromMessageData(messageData, instrumentMessages = false) {
|
|
11
13
|
const reader = new BufferReader(messageData);
|
|
14
|
+
const timestamp = instrumentMessages ? new Date(Number(reader.readUInt64())) : undefined;
|
|
12
15
|
const payload = reader.readBuffer();
|
|
13
|
-
return new P2PMessage(payload);
|
|
16
|
+
return new P2PMessage(payload, timestamp);
|
|
14
17
|
}
|
|
15
18
|
toMessageData() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const arr = [];
|
|
20
|
+
if (this.timestamp) {
|
|
21
|
+
arr.push(bigintToUInt64BE(BigInt(this.timestamp.getTime())));
|
|
22
|
+
}
|
|
23
|
+
arr.push(serializeToBuffer(this.payload.length, this.payload));
|
|
24
|
+
return serializeToBuffer(arr);
|
|
19
25
|
}
|
|
20
26
|
}
|
|
21
27
|
/**
|
package/dest/tests/mocks.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { BlockHeader, GlobalVariables, ProtocolContracts, StateReference, Tx } f
|
|
|
21
21
|
import { TxSimulationResult } from '../tx/simulated_tx.js';
|
|
22
22
|
import { TxHash } from '../tx/tx_hash.js';
|
|
23
23
|
export declare const randomTxHash: () => TxHash;
|
|
24
|
-
export declare const randomUniqueNote: ({ note,
|
|
24
|
+
export declare const randomUniqueNote: ({ note, contractAddress, txHash, storageSlot, noteNonce, }?: Partial<UniqueNote>) => Promise<UniqueNote>;
|
|
25
25
|
export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRequests, numberOfRevertiblePublicCallRequests, numberOfRevertibleNullifiers, hasPublicTeardownCallRequest, publicCalldataSize, feePayer, chonkProof, maxPriorityFeesPerGas, gasUsed, chainId, version, vkTreeRoot, protocolContractsHash, }?: {
|
|
26
26
|
numberOfNonRevertiblePublicCallRequests?: number;
|
|
27
27
|
numberOfRevertiblePublicCallRequests?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAe,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAyC,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIlE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,o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EAIlC,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,EAAE,CAAC;IACb,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC;CACZ;AAqBD,eAAO,MAAM,0CAA0C,GACrD,wBAAwB,+BAA+B,EACvD,SAAQ,eAA0C,0CAOnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,UAAU,2BAA2B,KAAG,aAIzE,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAAI,UAAU,2BAA2B,KAAG,gBAyB5E,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,OAAO,OAAO,EACd,iBAAiB,eAAe,EAChC,iBAAiB,eAAe,KAC/B,gBAsBF,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAAO,GACzC,OAAO,CAAC,gBAAgB,CAAC,CAc3B"}
|
package/dest/tests/mocks.js
CHANGED
|
@@ -40,8 +40,8 @@ import { TxEffect } from '../tx/tx_effect.js';
|
|
|
40
40
|
import { TxHash } from '../tx/tx_hash.js';
|
|
41
41
|
import { makeAvmCircuitInputs, makeAztecAddress, makeGas, makeGlobalVariables, makeHeader, makeL2BlockHeader, makePrivateToPublicAccumulatedData, makePrivateToRollupAccumulatedData, makeProtocolContracts, makePublicCallRequest, makePublicDataWrite } from './factories.js';
|
|
42
42
|
export const randomTxHash = ()=>TxHash.random();
|
|
43
|
-
export const randomUniqueNote = async ({ note = Note.random(),
|
|
44
|
-
return new UniqueNote(note,
|
|
43
|
+
export const randomUniqueNote = async ({ note = Note.random(), contractAddress = undefined, txHash = randomTxHash(), storageSlot = Fr.random(), noteNonce = Fr.random() } = {})=>{
|
|
44
|
+
return new UniqueNote(note, contractAddress ?? await AztecAddress.random(), storageSlot, txHash, noteNonce);
|
|
45
45
|
};
|
|
46
46
|
export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertibleNullifiers = 0, hasPublicTeardownCallRequest = false, publicCalldataSize = 2, feePayer, chonkProof = ChonkProof.random(), maxPriorityFeesPerGas, gasUsed = Gas.empty(), chainId = Fr.ZERO, version = Fr.ZERO, vkTreeRoot = Fr.ZERO, protocolContractsHash = Fr.ZERO } = {})=>{
|
|
47
47
|
const totalPublicCallRequests = numberOfNonRevertiblePublicCallRequests + numberOfRevertiblePublicCallRequests + (hasPublicTeardownCallRequest ? 1 : 0);
|
|
@@ -19,6 +19,8 @@ export declare class NoteAndSlot {
|
|
|
19
19
|
note: Note;
|
|
20
20
|
/** The storage slot of the note. */
|
|
21
21
|
storageSlot: Fr;
|
|
22
|
+
/** The randomness injected to the note. */
|
|
23
|
+
randomness: Fr;
|
|
22
24
|
/** The note type identifier. */
|
|
23
25
|
noteTypeId: NoteSelector;
|
|
24
26
|
constructor(
|
|
@@ -26,24 +28,30 @@ export declare class NoteAndSlot {
|
|
|
26
28
|
note: Note,
|
|
27
29
|
/** The storage slot of the note. */
|
|
28
30
|
storageSlot: Fr,
|
|
31
|
+
/** The randomness injected to the note. */
|
|
32
|
+
randomness: Fr,
|
|
29
33
|
/** The note type identifier. */
|
|
30
34
|
noteTypeId: NoteSelector);
|
|
31
35
|
static get schema(): z.ZodEffects<z.ZodObject<{
|
|
32
36
|
note: z.ZodEffects<ZodFor<Buffer<ArrayBufferLike>>, Note, any>;
|
|
33
37
|
storageSlot: ZodFor<Fr>;
|
|
38
|
+
randomness: ZodFor<Fr>;
|
|
34
39
|
noteTypeId: z.ZodType<NoteSelector, any, string>;
|
|
35
40
|
}, "strip", z.ZodTypeAny, {
|
|
36
41
|
storageSlot: Fr;
|
|
37
42
|
note: Note;
|
|
43
|
+
randomness: Fr;
|
|
38
44
|
noteTypeId: NoteSelector;
|
|
39
45
|
}, {
|
|
40
46
|
noteTypeId: string;
|
|
41
47
|
storageSlot?: any;
|
|
42
48
|
note?: any;
|
|
49
|
+
randomness?: any;
|
|
43
50
|
}>, NoteAndSlot, {
|
|
44
51
|
noteTypeId: string;
|
|
45
52
|
storageSlot?: any;
|
|
46
53
|
note?: any;
|
|
54
|
+
randomness?: any;
|
|
47
55
|
}>;
|
|
48
56
|
static from(fields: FieldsOf<NoteAndSlot>): NoteAndSlot;
|
|
49
57
|
static random(): NoteAndSlot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_execution_result.d.ts","sourceRoot":"","sources":["../../src/tx/private_execution_result.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,MAAM,EAAsB,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;GAEG;AACH,qBAAa,WAAW;IAEpB,gBAAgB;IACT,IAAI,EAAE,IAAI;IACjB,oCAAoC;IAC7B,WAAW,EAAE,EAAE;IACtB,gCAAgC;IACzB,UAAU,EAAE,YAAY;;
|
|
1
|
+
{"version":3,"file":"private_execution_result.d.ts","sourceRoot":"","sources":["../../src/tx/private_execution_result.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,MAAM,EAAsB,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;GAEG;AACH,qBAAa,WAAW;IAEpB,gBAAgB;IACT,IAAI,EAAE,IAAI;IACjB,oCAAoC;IAC7B,WAAW,EAAE,EAAE;IACtB,2CAA2C;IACpC,UAAU,EAAE,EAAE;IACrB,gCAAgC;IACzB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_values.js';
|
|
|
15
15
|
*/ export class NoteAndSlot {
|
|
16
16
|
note;
|
|
17
17
|
storageSlot;
|
|
18
|
+
randomness;
|
|
18
19
|
noteTypeId;
|
|
19
|
-
constructor(/** The note. */ note, /** The storage slot of the note. */ storageSlot, /** The note type identifier. */ noteTypeId){
|
|
20
|
+
constructor(/** The note. */ note, /** The storage slot of the note. */ storageSlot, /** The randomness injected to the note. */ randomness, /** The note type identifier. */ noteTypeId){
|
|
20
21
|
this.note = note;
|
|
21
22
|
this.storageSlot = storageSlot;
|
|
23
|
+
this.randomness = randomness;
|
|
22
24
|
this.noteTypeId = noteTypeId;
|
|
23
25
|
}
|
|
24
26
|
static get schema() {
|
|
25
27
|
return z.object({
|
|
26
28
|
note: Note.schema,
|
|
27
29
|
storageSlot: schemas.Fr,
|
|
30
|
+
randomness: schemas.Fr,
|
|
28
31
|
noteTypeId: schemas.NoteSelector
|
|
29
32
|
}).transform(NoteAndSlot.from);
|
|
30
33
|
}
|
|
31
34
|
static from(fields) {
|
|
32
|
-
return new NoteAndSlot(fields.note, fields.storageSlot, fields.noteTypeId);
|
|
35
|
+
return new NoteAndSlot(fields.note, fields.storageSlot, fields.randomness, fields.noteTypeId);
|
|
33
36
|
}
|
|
34
37
|
static random() {
|
|
35
|
-
return new NoteAndSlot(Note.random(), Fr.random(), NoteSelector.random());
|
|
38
|
+
return new NoteAndSlot(Note.random(), Fr.random(), Fr.random(), NoteSelector.random());
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
export class CountedContractClassLog {
|
package/dest/tx/tx.d.ts
CHANGED
|
@@ -123,9 +123,10 @@ export declare class Tx extends Gossipable {
|
|
|
123
123
|
/**
|
|
124
124
|
* Clones a tx, making a deep copy of all fields.
|
|
125
125
|
* @param tx - The transaction to be cloned.
|
|
126
|
+
* @param cloneProof - Whether to clone the proof as well. If false, will shallow copy.
|
|
126
127
|
* @returns The cloned transaction.
|
|
127
128
|
*/
|
|
128
|
-
static clone(tx: Tx): Tx;
|
|
129
|
+
static clone(tx: Tx, cloneProof?: boolean): Tx;
|
|
129
130
|
/**
|
|
130
131
|
* Creates a random tx.
|
|
131
132
|
* @param randomProof - Whether to create a random proof - this will be random bytes of the full size.
|
package/dest/tx/tx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/tx/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAyD,MAAM,6BAA6B,CAAC;AAClH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,oCAAoC,EAAE,MAAM,wDAAwD,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;GAEG;AACH,qBAAa,EAAG,SAAQ,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
|
192
192
|
* @param tx - The transaction to be cloned.
|
|
193
|
+
* @param cloneProof - Whether to clone the proof as well. If false, will shallow copy.
|
|
193
194
|
* @returns The cloned transaction.
|
|
194
|
-
*/ static clone(tx) {
|
|
195
|
+
*/ static clone(tx, cloneProof = true) {
|
|
195
196
|
const publicInputs = PrivateKernelTailCircuitPublicInputs.fromBuffer(tx.data.toBuffer());
|
|
196
|
-
const chonkProof = ChonkProof.fromBuffer(tx.chonkProof.toBuffer());
|
|
197
|
+
const chonkProof = cloneProof ? ChonkProof.fromBuffer(tx.chonkProof.toBuffer()) : tx.chonkProof;
|
|
197
198
|
const contractClassLogFields = tx.contractClassLogFields.map((p)=>p.clone());
|
|
198
199
|
const publicFunctionCalldata = tx.publicFunctionCalldata.map((cd)=>HashedValues.fromBuffer(cd.toBuffer()));
|
|
199
200
|
const clonedTx = new Tx(tx.txHash, publicInputs, chonkProof, contractClassLogFields, publicFunctionCalldata);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251126",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
75
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
76
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
77
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
78
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
79
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
80
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
81
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
75
|
+
"@aztec/bb.js": "3.0.0-nightly.20251126",
|
|
76
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251126",
|
|
77
|
+
"@aztec/constants": "3.0.0-nightly.20251126",
|
|
78
|
+
"@aztec/ethereum": "3.0.0-nightly.20251126",
|
|
79
|
+
"@aztec/foundation": "3.0.0-nightly.20251126",
|
|
80
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251126",
|
|
81
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251126",
|
|
82
82
|
"@google-cloud/storage": "^7.15.0",
|
|
83
83
|
"axios": "^1.12.0",
|
|
84
84
|
"json-stringify-deterministic": "1.0.12",
|
package/src/note/unique_note.ts
CHANGED
|
@@ -16,8 +16,6 @@ export class UniqueNote {
|
|
|
16
16
|
constructor(
|
|
17
17
|
/** The note as emitted from the Noir contract. */
|
|
18
18
|
public note: Note,
|
|
19
|
-
/** The recipient whose public key was used to encrypt the note. */
|
|
20
|
-
public recipient: AztecAddress,
|
|
21
19
|
/** The contract address this note is created in. */
|
|
22
20
|
public contractAddress: AztecAddress,
|
|
23
21
|
/** The specific storage location of the note on the contract. */
|
|
@@ -32,50 +30,34 @@ export class UniqueNote {
|
|
|
32
30
|
return z
|
|
33
31
|
.object({
|
|
34
32
|
note: Note.schema,
|
|
35
|
-
recipient: schemas.AztecAddress,
|
|
36
33
|
contractAddress: schemas.AztecAddress,
|
|
37
34
|
storageSlot: schemas.Fr,
|
|
38
35
|
txHash: TxHash.schema,
|
|
39
36
|
noteNonce: schemas.Fr,
|
|
40
37
|
})
|
|
41
|
-
.transform(({ note,
|
|
42
|
-
return new UniqueNote(note,
|
|
38
|
+
.transform(({ note, contractAddress, storageSlot, txHash, noteNonce }) => {
|
|
39
|
+
return new UniqueNote(note, contractAddress, storageSlot, txHash, noteNonce);
|
|
43
40
|
});
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
toBuffer(): Buffer {
|
|
47
|
-
return serializeToBuffer([
|
|
48
|
-
this.note,
|
|
49
|
-
this.recipient,
|
|
50
|
-
this.contractAddress,
|
|
51
|
-
this.storageSlot,
|
|
52
|
-
this.txHash,
|
|
53
|
-
this.noteNonce,
|
|
54
|
-
]);
|
|
44
|
+
return serializeToBuffer([this.note, this.contractAddress, this.storageSlot, this.txHash, this.noteNonce]);
|
|
55
45
|
}
|
|
56
46
|
|
|
57
47
|
static async random() {
|
|
58
|
-
return new UniqueNote(
|
|
59
|
-
Note.random(),
|
|
60
|
-
await AztecAddress.random(),
|
|
61
|
-
await AztecAddress.random(),
|
|
62
|
-
Fr.random(),
|
|
63
|
-
TxHash.random(),
|
|
64
|
-
Fr.random(),
|
|
65
|
-
);
|
|
48
|
+
return new UniqueNote(Note.random(), await AztecAddress.random(), Fr.random(), TxHash.random(), Fr.random());
|
|
66
49
|
}
|
|
67
50
|
|
|
68
51
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
69
52
|
const reader = BufferReader.asReader(buffer);
|
|
70
53
|
|
|
71
54
|
const note = reader.readObject(Note);
|
|
72
|
-
const recipient = reader.readObject(AztecAddress);
|
|
73
55
|
const contractAddress = reader.readObject(AztecAddress);
|
|
74
56
|
const storageSlot = reader.readObject(Fr);
|
|
75
57
|
const txHash = reader.readObject(TxHash);
|
|
76
58
|
const noteNonce = reader.readObject(Fr);
|
|
77
59
|
|
|
78
|
-
return new UniqueNote(note,
|
|
60
|
+
return new UniqueNote(note, contractAddress, storageSlot, txHash, noteNonce);
|
|
79
61
|
}
|
|
80
62
|
|
|
81
63
|
static fromString(str: string) {
|
package/src/p2p/gossipable.ts
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
2
|
+
import { BufferReader, bigintToUInt64BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
3
|
|
|
4
4
|
import type { TopicType } from './topic_type.js';
|
|
5
5
|
|
|
6
6
|
export class P2PMessage {
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(
|
|
8
|
+
public readonly payload: Buffer,
|
|
9
|
+
public readonly timestamp?: Date,
|
|
10
|
+
) {}
|
|
8
11
|
|
|
9
|
-
static fromGossipable(message: Gossipable): P2PMessage {
|
|
10
|
-
return new P2PMessage(message.toBuffer());
|
|
12
|
+
static fromGossipable(message: Gossipable, instrumentMessages = false): P2PMessage {
|
|
13
|
+
return new P2PMessage(message.toBuffer(), instrumentMessages ? new Date() : undefined);
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
static fromMessageData(messageData: Buffer): P2PMessage {
|
|
16
|
+
static fromMessageData(messageData: Buffer, instrumentMessages = false): P2PMessage {
|
|
14
17
|
const reader = new BufferReader(messageData);
|
|
18
|
+
const timestamp = instrumentMessages ? new Date(Number(reader.readUInt64())) : undefined;
|
|
15
19
|
const payload = reader.readBuffer();
|
|
16
|
-
return new P2PMessage(payload);
|
|
20
|
+
return new P2PMessage(payload, timestamp);
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
toMessageData(): Buffer {
|
|
20
|
-
|
|
24
|
+
const arr: Buffer[] = [];
|
|
25
|
+
if (this.timestamp) {
|
|
26
|
+
arr.push(bigintToUInt64BE(BigInt(this.timestamp.getTime())));
|
|
27
|
+
}
|
|
28
|
+
arr.push(serializeToBuffer(this.payload.length, this.payload));
|
|
29
|
+
return serializeToBuffer(arr);
|
|
21
30
|
}
|
|
22
31
|
}
|
|
23
32
|
|
package/src/tests/mocks.ts
CHANGED
|
@@ -84,20 +84,12 @@ export const randomTxHash = (): TxHash => TxHash.random();
|
|
|
84
84
|
|
|
85
85
|
export const randomUniqueNote = async ({
|
|
86
86
|
note = Note.random(),
|
|
87
|
-
recipient = undefined,
|
|
88
87
|
contractAddress = undefined,
|
|
89
88
|
txHash = randomTxHash(),
|
|
90
89
|
storageSlot = Fr.random(),
|
|
91
90
|
noteNonce = Fr.random(),
|
|
92
91
|
}: Partial<UniqueNote> = {}) => {
|
|
93
|
-
return new UniqueNote(
|
|
94
|
-
note,
|
|
95
|
-
recipient ?? (await AztecAddress.random()),
|
|
96
|
-
contractAddress ?? (await AztecAddress.random()),
|
|
97
|
-
storageSlot,
|
|
98
|
-
txHash,
|
|
99
|
-
noteNonce,
|
|
100
|
-
);
|
|
92
|
+
return new UniqueNote(note, contractAddress ?? (await AztecAddress.random()), storageSlot, txHash, noteNonce);
|
|
101
93
|
};
|
|
102
94
|
|
|
103
95
|
export const mockTx = async (
|
|
@@ -26,6 +26,8 @@ export class NoteAndSlot {
|
|
|
26
26
|
public note: Note,
|
|
27
27
|
/** The storage slot of the note. */
|
|
28
28
|
public storageSlot: Fr,
|
|
29
|
+
/** The randomness injected to the note. */
|
|
30
|
+
public randomness: Fr,
|
|
29
31
|
/** The note type identifier. */
|
|
30
32
|
public noteTypeId: NoteSelector,
|
|
31
33
|
) {}
|
|
@@ -35,17 +37,18 @@ export class NoteAndSlot {
|
|
|
35
37
|
.object({
|
|
36
38
|
note: Note.schema,
|
|
37
39
|
storageSlot: schemas.Fr,
|
|
40
|
+
randomness: schemas.Fr,
|
|
38
41
|
noteTypeId: schemas.NoteSelector,
|
|
39
42
|
})
|
|
40
43
|
.transform(NoteAndSlot.from);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
static from(fields: FieldsOf<NoteAndSlot>) {
|
|
44
|
-
return new NoteAndSlot(fields.note, fields.storageSlot, fields.noteTypeId);
|
|
47
|
+
return new NoteAndSlot(fields.note, fields.storageSlot, fields.randomness, fields.noteTypeId);
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
static random() {
|
|
48
|
-
return new NoteAndSlot(Note.random(), Fr.random(), NoteSelector.random());
|
|
51
|
+
return new NoteAndSlot(Note.random(), Fr.random(), Fr.random(), NoteSelector.random());
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
|
package/src/tx/tx.ts
CHANGED
|
@@ -271,11 +271,12 @@ export class Tx extends Gossipable {
|
|
|
271
271
|
/**
|
|
272
272
|
* Clones a tx, making a deep copy of all fields.
|
|
273
273
|
* @param tx - The transaction to be cloned.
|
|
274
|
+
* @param cloneProof - Whether to clone the proof as well. If false, will shallow copy.
|
|
274
275
|
* @returns The cloned transaction.
|
|
275
276
|
*/
|
|
276
|
-
static clone(tx: Tx): Tx {
|
|
277
|
+
static clone(tx: Tx, cloneProof = true): Tx {
|
|
277
278
|
const publicInputs = PrivateKernelTailCircuitPublicInputs.fromBuffer(tx.data.toBuffer());
|
|
278
|
-
const chonkProof = ChonkProof.fromBuffer(tx.chonkProof.toBuffer());
|
|
279
|
+
const chonkProof = cloneProof ? ChonkProof.fromBuffer(tx.chonkProof.toBuffer()) : tx.chonkProof;
|
|
279
280
|
const contractClassLogFields = tx.contractClassLogFields.map(p => p.clone());
|
|
280
281
|
const publicFunctionCalldata = tx.publicFunctionCalldata.map(cd => HashedValues.fromBuffer(cd.toBuffer()));
|
|
281
282
|
const clonedTx = new Tx(tx.txHash, publicInputs, chonkProof, contractClassLogFields, publicFunctionCalldata);
|