@aztec/stdlib 0.86.0-nightly.20250512 → 0.86.0-nightly.20250514
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/abi/contract_artifact.js +3 -16
- package/dest/file-store/http.d.ts +1 -0
- package/dest/file-store/http.d.ts.map +1 -1
- package/dest/file-store/http.js +32 -16
- package/dest/interfaces/pxe.d.ts +2 -3
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/pxe.js +2 -2
- package/dest/messaging/inbox_leaf.d.ts +5 -0
- package/dest/messaging/inbox_leaf.d.ts.map +1 -1
- package/dest/messaging/inbox_leaf.js +11 -0
- package/dest/p2p/block_attestation.d.ts +1 -1
- package/dest/p2p/block_attestation.d.ts.map +1 -1
- package/dest/p2p/block_attestation.js +1 -1
- package/dest/p2p/block_proposal.d.ts +1 -1
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/gossipable.d.ts +14 -2
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/gossipable.js +43 -0
- package/dest/tx/profiling.d.ts +8 -0
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +31 -0
- package/dest/tx/tx.d.ts +1 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +1 -1
- package/package.json +8 -7
- package/src/abi/contract_artifact.ts +3 -17
- package/src/file-store/http.ts +23 -17
- package/src/interfaces/pxe.ts +3 -4
- package/src/messaging/inbox_leaf.ts +10 -0
- package/src/p2p/block_attestation.ts +1 -1
- package/src/p2p/block_proposal.ts +1 -1
- package/src/p2p/gossipable.ts +40 -2
- package/src/tx/profiling.ts +32 -0
- package/src/tx/tx.ts +1 -1
|
@@ -166,29 +166,16 @@ import { AZTEC_INITIALIZER_ATTRIBUTE, AZTEC_INTERNAL_ATTRIBUTE, AZTEC_PRIVATE_AT
|
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
function getFunctionType(fn) {
|
|
169
|
-
if (fn.custom_attributes.
|
|
169
|
+
if (fn.custom_attributes.includes(AZTEC_PRIVATE_ATTRIBUTE)) {
|
|
170
170
|
return FunctionType.PRIVATE;
|
|
171
|
-
} else if (fn.custom_attributes.
|
|
171
|
+
} else if (fn.custom_attributes.includes(AZTEC_PUBLIC_ATTRIBUTE)) {
|
|
172
172
|
return FunctionType.PUBLIC;
|
|
173
|
-
} else if (fn.custom_attributes.
|
|
173
|
+
} else if (fn.custom_attributes.includes(AZTEC_UTILITY_ATTRIBUTE)) {
|
|
174
174
|
return FunctionType.UTILITY;
|
|
175
175
|
} else {
|
|
176
176
|
throw new Error(`Invalid function type for a noir contract function ${fn.name}`);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
// TODO(https://github.com/noir-lang/noir/issues/7912): Replace the above function with this one once the linked issue
|
|
180
|
-
// is fixed.
|
|
181
|
-
// function getFunctionType(fn: NoirCompiledContractFunction): FunctionType {
|
|
182
|
-
// if (fn.custom_attributes.includes(AZTEC_PRIVATE_ATTRIBUTE)) {
|
|
183
|
-
// return FunctionType.PRIVATE;
|
|
184
|
-
// } else if (fn.custom_attributes.includes(AZTEC_PUBLIC_ATTRIBUTE)) {
|
|
185
|
-
// return FunctionType.PUBLIC;
|
|
186
|
-
// } else if (fn.custom_attributes.includes(AZTEC_UTILITY_ATTRIBUTE)) {
|
|
187
|
-
// return FunctionType.UTILITY;
|
|
188
|
-
// } else {
|
|
189
|
-
// throw new Error(`Invalid function type for a noir contract function ${fn.name}`);
|
|
190
|
-
// }
|
|
191
|
-
// }
|
|
192
179
|
/**
|
|
193
180
|
* Returns true if the first parameter is kernel function inputs.
|
|
194
181
|
*
|
|
@@ -5,6 +5,7 @@ import type { ReadOnlyFileStore } from './interface.js';
|
|
|
5
5
|
export declare class HttpFileStore implements ReadOnlyFileStore {
|
|
6
6
|
private readonly baseUrl;
|
|
7
7
|
private readonly log;
|
|
8
|
+
private readonly axiosInstance;
|
|
8
9
|
private readonly fetch;
|
|
9
10
|
constructor(baseUrl: string, log?: Logger);
|
|
10
11
|
read(pathOrUrl: string): Promise<Buffer>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/file-store/http.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/file-store/http.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAUlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,qBAAa,aAAc,YAAW,iBAAiB;IAIzC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAAU,OAAO,CAAC,QAAQ,CAAC,GAAG;IAHlE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+D;gBAExD,OAAO,EAAE,MAAM,EAAmB,GAAG,GAAE,MAA+C;IAatG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUxC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5D,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUxD,OAAO,CAAC,MAAM;CAGf"}
|
package/dest/file-store/http.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
3
|
+
import axios from 'axios';
|
|
3
4
|
import { createWriteStream } from 'fs';
|
|
4
5
|
import { mkdir } from 'fs/promises';
|
|
5
6
|
import { dirname } from 'path';
|
|
6
|
-
import { Readable } from 'stream';
|
|
7
7
|
import { finished } from 'stream/promises';
|
|
8
8
|
export class HttpFileStore {
|
|
9
9
|
baseUrl;
|
|
10
10
|
log;
|
|
11
|
+
axiosInstance;
|
|
11
12
|
fetch;
|
|
12
13
|
constructor(baseUrl, log = createLogger('stdlib:http-file-store')){
|
|
13
14
|
this.baseUrl = baseUrl;
|
|
14
15
|
this.log = log;
|
|
15
|
-
this.
|
|
16
|
-
|
|
16
|
+
this.axiosInstance = axios.create();
|
|
17
|
+
this.fetch = async (config)=>{
|
|
18
|
+
return await retry(()=>this.axiosInstance.request(config), `Fetching ${config.url}`, makeBackoff([
|
|
17
19
|
1,
|
|
18
20
|
1,
|
|
19
21
|
3
|
|
@@ -22,30 +24,44 @@ export class HttpFileStore {
|
|
|
22
24
|
}
|
|
23
25
|
async read(pathOrUrl) {
|
|
24
26
|
const url = this.getUrl(pathOrUrl);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
try {
|
|
28
|
+
const response = await this.fetch({
|
|
29
|
+
url,
|
|
30
|
+
method: 'GET',
|
|
31
|
+
responseType: 'arraybuffer'
|
|
32
|
+
});
|
|
33
|
+
return Buffer.from(response.data);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
throw new Error(`Error fetching file from ${url}: ${error instanceof Error ? error.message : String(error)}`);
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
38
|
async download(pathOrUrl, destPath) {
|
|
33
39
|
const url = this.getUrl(pathOrUrl);
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
try {
|
|
41
|
+
const response = await this.fetch({
|
|
42
|
+
url,
|
|
43
|
+
method: 'GET',
|
|
44
|
+
responseType: 'stream'
|
|
45
|
+
});
|
|
36
46
|
await mkdir(dirname(destPath), {
|
|
37
47
|
recursive: true
|
|
38
48
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
throw new Error(`Error fetching file from ${url}: ${response.statusText}`);
|
|
49
|
+
await finished(response.data.pipe(createWriteStream(destPath)));
|
|
50
|
+
} catch (error) {
|
|
51
|
+
throw new Error(`Error fetching file from ${url}: ${error instanceof Error ? error.message : String(error)}`);
|
|
43
52
|
}
|
|
44
53
|
}
|
|
45
54
|
async exists(pathOrUrl) {
|
|
46
55
|
const url = this.getUrl(pathOrUrl);
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
try {
|
|
57
|
+
await this.fetch({
|
|
58
|
+
url,
|
|
59
|
+
method: 'HEAD'
|
|
60
|
+
});
|
|
61
|
+
return true;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
49
65
|
}
|
|
50
66
|
getUrl(path) {
|
|
51
67
|
return URL.canParse(path) ? path : `${this.baseUrl.replace(/\/$/, '')}/${path}`;
|
package/dest/interfaces/pxe.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { Fr } from '@aztec/foundation/fields';
|
|
|
3
3
|
import type { ApiSchemaFor } from '@aztec/foundation/schemas';
|
|
4
4
|
import { SiblingPath } from '@aztec/foundation/trees';
|
|
5
5
|
import { type AbiType, type ContractArtifact } from '../abi/abi.js';
|
|
6
|
-
import type { AbiDecoded } from '../abi/decoder.js';
|
|
7
6
|
import type { EventSelector } from '../abi/event_selector.js';
|
|
8
7
|
import { AuthWitness } from '../auth_witness/auth_witness.js';
|
|
9
8
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
@@ -14,7 +13,7 @@ import { type LogFilter } from '../logs/log_filter.js';
|
|
|
14
13
|
import { UniqueNote } from '../note/extended_note.js';
|
|
15
14
|
import { type NotesFilter } from '../note/notes_filter.js';
|
|
16
15
|
import { type IndexedTxEffect, PrivateExecutionResult, Tx, TxExecutionRequest, TxHash, TxReceipt, TxSimulationResult } from '../tx/index.js';
|
|
17
|
-
import { TxProfileResult } from '../tx/profiling.js';
|
|
16
|
+
import { TxProfileResult, UtilitySimulationResult } from '../tx/profiling.js';
|
|
18
17
|
import { TxProvingResult } from '../tx/proven_tx.js';
|
|
19
18
|
import { type GetContractClassLogsResponse, type GetPublicLogsResponse } from './get_logs_response.js';
|
|
20
19
|
/**
|
|
@@ -218,7 +217,7 @@ export interface PXE {
|
|
|
218
217
|
* default to all.
|
|
219
218
|
* @returns The result of the utility function call, structured based on the function ABI.
|
|
220
219
|
*/
|
|
221
|
-
simulateUtility(functionName: string, args: any[], to: AztecAddress, authwits?: AuthWitness[], from?: AztecAddress, scopes?: AztecAddress[]): Promise<
|
|
220
|
+
simulateUtility(functionName: string, args: any[], to: AztecAddress, authwits?: AuthWitness[], from?: AztecAddress, scopes?: AztecAddress[]): Promise<UtilitySimulationResult>;
|
|
222
221
|
/**
|
|
223
222
|
* Gets public logs based on the provided filter.
|
|
224
223
|
* @param filter - The filter to apply to the logs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe.d.ts","sourceRoot":"","sources":["../../src/interfaces/pxe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAU,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD,OAAO,EAAE,KAAK,OAAO,EAAiB,KAAK,gBAAgB,EAA0B,MAAM,eAAe,CAAC;AAC3G,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"pxe.d.ts","sourceRoot":"","sources":["../../src/interfaces/pxe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAU,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAA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,CAAC;CACvG;AAGD,MAAM,MAAM,uBAAuB,GAAG;IACpC,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAQF,oDAAoD;AACpD,oBAAY,SAAS;IACnB,SAAS,cAAc;IACvB,WAAW,gBAAgB;CAC5B;AAED,wDAAwD;AACxD,MAAM,WAAW,OAAO;IACtB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,yBAAyB,EAAE,yBAAyB,CAAC;CACtD;AAED,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IAC3D,qBAAqB,EAAE,OAAO,CAAC;IAC/B,0BAA0B,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAChD,iCAAiC,EAAE,OAAO,CAAC;IAC3C,QAAQ,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACzC;AAmBD,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,GAAG,CAoFvC,CAAC"}
|
package/dest/interfaces/pxe.js
CHANGED
|
@@ -11,7 +11,7 @@ import { UniqueNote } from '../note/extended_note.js';
|
|
|
11
11
|
import { NotesFilterSchema } from '../note/notes_filter.js';
|
|
12
12
|
import { AbiDecodedSchema, optional, schemas } from '../schemas/schemas.js';
|
|
13
13
|
import { PrivateExecutionResult, Tx, TxExecutionRequest, TxHash, TxReceipt, TxSimulationResult, indexedTxSchema } from '../tx/index.js';
|
|
14
|
-
import { TxProfileResult } from '../tx/profiling.js';
|
|
14
|
+
import { TxProfileResult, UtilitySimulationResult } from '../tx/profiling.js';
|
|
15
15
|
import { TxProvingResult } from '../tx/proven_tx.js';
|
|
16
16
|
import { GetContractClassLogsResponseSchema, GetPublicLogsResponseSchema } from './get_logs_response.js';
|
|
17
17
|
const EventMetadataDefinitionSchema = z.object({
|
|
@@ -86,7 +86,7 @@ export const PXESchema = {
|
|
|
86
86
|
z.undefined()
|
|
87
87
|
])),
|
|
88
88
|
getCurrentBaseFees: z.function().returns(GasFees.schema),
|
|
89
|
-
simulateUtility: z.function().args(z.string(), z.array(z.any()), schemas.AztecAddress, optional(z.array(AuthWitness.schema)), optional(schemas.AztecAddress), optional(z.array(schemas.AztecAddress))).returns(
|
|
89
|
+
simulateUtility: z.function().args(z.string(), z.array(z.any()), schemas.AztecAddress, optional(z.array(AuthWitness.schema)), optional(schemas.AztecAddress), optional(z.array(schemas.AztecAddress))).returns(UtilitySimulationResult.schema),
|
|
90
90
|
getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
|
|
91
91
|
getContractClassLogs: z.function().args(LogFilterSchema).returns(GetContractClassLogsResponseSchema),
|
|
92
92
|
getBlockNumber: z.function().returns(z.number()),
|
|
@@ -15,5 +15,10 @@ export declare class InboxLeaf {
|
|
|
15
15
|
toBuffer(): Buffer;
|
|
16
16
|
fromBuffer(buffer: Buffer | BufferReader): InboxLeaf;
|
|
17
17
|
static smallestIndexFromL2Block(l2block: bigint): bigint;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the range of valid indices for a given L2 block.
|
|
20
|
+
* Start index is inclusive, end index is exclusive.
|
|
21
|
+
*/
|
|
22
|
+
static indexRangeFromL2Block(l2block: bigint): [bigint, bigint];
|
|
18
23
|
}
|
|
19
24
|
//# sourceMappingURL=inbox_leaf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox_leaf.d.ts","sourceRoot":"","sources":["../../src/messaging/inbox_leaf.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,qBAAa,SAAS;IAElB,2CAA2C;aAC3B,KAAK,EAAE,MAAM;IAC7B,wCAAwC;aACxB,IAAI,EAAE,EAAE;;IAHxB,2CAA2C;IAC3B,KAAK,EAAE,MAAM;IAC7B,wCAAwC;IACxB,IAAI,EAAE,EAAE;IAG1B,QAAQ,IAAI,MAAM;IAIlB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAOpD,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"inbox_leaf.d.ts","sourceRoot":"","sources":["../../src/messaging/inbox_leaf.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,qBAAa,SAAS;IAElB,2CAA2C;aAC3B,KAAK,EAAE,MAAM;IAC7B,wCAAwC;aACxB,IAAI,EAAE,EAAE;;IAHxB,2CAA2C;IAC3B,KAAK,EAAE,MAAM;IAC7B,wCAAwC;IACxB,IAAI,EAAE,EAAE;IAG1B,QAAQ,IAAI,MAAM;IAIlB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAOpD,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIxD;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAKhE"}
|
|
@@ -24,4 +24,15 @@ export class InboxLeaf {
|
|
|
24
24
|
static smallestIndexFromL2Block(l2block) {
|
|
25
25
|
return (l2block - BigInt(INITIAL_L2_BLOCK_NUM)) * BigInt(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the range of valid indices for a given L2 block.
|
|
29
|
+
* Start index is inclusive, end index is exclusive.
|
|
30
|
+
*/ static indexRangeFromL2Block(l2block) {
|
|
31
|
+
const start = this.smallestIndexFromL2Block(l2block);
|
|
32
|
+
const end = start + BigInt(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
33
|
+
return [
|
|
34
|
+
start,
|
|
35
|
+
end
|
|
36
|
+
];
|
|
37
|
+
}
|
|
27
38
|
}
|
|
@@ -35,7 +35,7 @@ export declare class BlockAttestation extends Gossipable {
|
|
|
35
35
|
/** The signature of the block attester */
|
|
36
36
|
signature: Signature);
|
|
37
37
|
static get schema(): ZodFor<BlockAttestation>;
|
|
38
|
-
|
|
38
|
+
generateP2PMessageIdentifier(): Promise<Buffer32>;
|
|
39
39
|
get archive(): Fr;
|
|
40
40
|
get slotNumber(): Fr;
|
|
41
41
|
/**Get sender
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_attestation.d.ts","sourceRoot":"","sources":["../../src/p2p/block_attestation.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAI9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,oBAAqB,SAAQ,QAAQ;gBACpC,IAAI,EAAE,MAAM;CAGzB;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAM5C,2CAA2C;aAC3B,WAAW,EAAE,EAAE;IAE/B,iEAAiE;aACjD,OAA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;IAE/B,iEAAiE;IACjD,OAAO,EAAE,gBAAgB;IAEzC,0CAA0C;IAC1B,SAAS,EAAE,SAAS;IAKtC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAQ5C;IAEQ,4BAA4B,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI1D,IAAI,OAAO,IAAI,EAAE,CAEhB;IAED,IAAI,UAAU,IAAI,EAAE,CAEnB;IAED;;;;OAIG;IACH,SAAS,IAAI,UAAU;IAWvB,UAAU,IAAI,MAAM;IAIpB,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,gBAAgB;IAS/D,MAAM,CAAC,KAAK,IAAI,gBAAgB;IAIhC,OAAO,IAAI,MAAM;CAGlB"}
|
|
@@ -34,7 +34,7 @@ export class BlockAttestationHash extends Buffer32 {
|
|
|
34
34
|
signature: Signature.schema
|
|
35
35
|
}).transform((obj)=>new BlockAttestation(obj.blockNumber, obj.payload, obj.signature));
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
generateP2PMessageIdentifier() {
|
|
38
38
|
return Promise.resolve(new BlockAttestationHash(keccak256(this.signature.toBuffer())));
|
|
39
39
|
}
|
|
40
40
|
get archive() {
|
|
@@ -38,7 +38,7 @@ export declare class BlockProposal extends Gossipable {
|
|
|
38
38
|
signature: Signature,
|
|
39
39
|
/** The transactions in the block */
|
|
40
40
|
txs?: Tx[] | undefined);
|
|
41
|
-
|
|
41
|
+
generateP2PMessageIdentifier(): Promise<Buffer32>;
|
|
42
42
|
get archive(): Fr;
|
|
43
43
|
get slotNumber(): Fr;
|
|
44
44
|
static createProposalFromSigner(blockNumber: Fr, payload: ConsensusPayload, txs: Tx[], payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<BlockProposal>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_proposal.d.ts","sourceRoot":"","sources":["../../src/p2p/block_proposal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AAG,aAAa;IAe5D,OAAO,IAAI,MAAM;CAQlB"}
|
|
@@ -29,7 +29,7 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
29
29
|
/** The transactions in the block */ txs){
|
|
30
30
|
super(), this.blockNumber = blockNumber, this.payload = payload, this.signature = signature, this.txs = txs;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
generateP2PMessageIdentifier() {
|
|
33
33
|
return Promise.resolve(new BlockProposalHash(keccak256(this.signature.toBuffer())));
|
|
34
34
|
}
|
|
35
35
|
get archive() {
|
package/dest/p2p/gossipable.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import
|
|
3
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
4
4
|
import type { TopicType } from './topic_type.js';
|
|
5
|
+
export declare class P2PMessage {
|
|
6
|
+
readonly publishTime: Date;
|
|
7
|
+
readonly id: Buffer32;
|
|
8
|
+
readonly payload: Buffer;
|
|
9
|
+
constructor(publishTime: Date, id: Buffer32, payload: Buffer);
|
|
10
|
+
static fromGossipable(message: Gossipable): Promise<P2PMessage>;
|
|
11
|
+
static fromMessageData(messageData: Buffer): P2PMessage;
|
|
12
|
+
toMessageData(): Buffer;
|
|
13
|
+
}
|
|
5
14
|
/**
|
|
6
15
|
* Gossipable
|
|
7
16
|
*
|
|
8
17
|
* Any class which extends gossipable will be able to be Gossiped over the p2p network
|
|
9
18
|
*/
|
|
10
19
|
export declare abstract class Gossipable {
|
|
20
|
+
private cachedId;
|
|
11
21
|
/** p2p Topic
|
|
12
22
|
*
|
|
13
23
|
* - The p2p topic identifier, this determines how the message is handled
|
|
@@ -17,12 +27,14 @@ export declare abstract class Gossipable {
|
|
|
17
27
|
*
|
|
18
28
|
* - A digest of the message information, this key is used for deduplication
|
|
19
29
|
*/
|
|
20
|
-
|
|
30
|
+
p2pMessageIdentifier(): Promise<Buffer32>;
|
|
31
|
+
abstract generateP2PMessageIdentifier(): Promise<Buffer32>;
|
|
21
32
|
/** To Buffer
|
|
22
33
|
*
|
|
23
34
|
* - Serialization method
|
|
24
35
|
*/
|
|
25
36
|
abstract toBuffer(): Buffer;
|
|
37
|
+
toMessage(): Buffer;
|
|
26
38
|
/**
|
|
27
39
|
* Get the size of the gossipable object.
|
|
28
40
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gossipable.d.ts","sourceRoot":"","sources":["../../src/p2p/gossipable.ts"],"names":[],"mappings":";;AAAA,OAAO,
|
|
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;aACO,WAAW,EAAE,IAAI;aAAkB,EAAE,EAAE,QAAQ;aAAkB,OAAO,EAAE,MAAM;gBAAhF,WAAW,EAAE,IAAI,EAAkB,EAAE,EAAE,QAAQ,EAAkB,OAAO,EAAE,MAAM;WAE/F,cAAc,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAIrE,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU;IAQvD,aAAa,IAAI,MAAM;CAOxB;AAED;;;;GAIG;AACH,8BAAsB,UAAU;IAC9B,OAAO,CAAC,QAAQ,CAAuB;IACvC;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE3B;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,QAAQ,CAAC;IAQ/C,QAAQ,CAAC,4BAA4B,IAAI,OAAO,CAAC,QAAQ,CAAC;IAE1D;;;OAGG;IACH,QAAQ,CAAC,QAAQ,IAAI,MAAM;IAE3B,SAAS,IAAI,MAAM;IAInB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,IAAI,MAAM;CAC3B"}
|
package/dest/p2p/gossipable.js
CHANGED
|
@@ -1,10 +1,53 @@
|
|
|
1
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
|
+
import { BufferReader, bigintToUInt64BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
+
export class P2PMessage {
|
|
4
|
+
publishTime;
|
|
5
|
+
id;
|
|
6
|
+
payload;
|
|
7
|
+
constructor(publishTime, id, payload){
|
|
8
|
+
this.publishTime = publishTime;
|
|
9
|
+
this.id = id;
|
|
10
|
+
this.payload = payload;
|
|
11
|
+
}
|
|
12
|
+
static async fromGossipable(message) {
|
|
13
|
+
return new P2PMessage(new Date(), await message.p2pMessageIdentifier(), message.toBuffer());
|
|
14
|
+
}
|
|
15
|
+
static fromMessageData(messageData) {
|
|
16
|
+
const reader = new BufferReader(messageData);
|
|
17
|
+
const publishTime = reader.readUInt64();
|
|
18
|
+
const id = Buffer32.fromBuffer(reader);
|
|
19
|
+
const payload = reader.readBuffer();
|
|
20
|
+
return new P2PMessage(new Date(Number(publishTime)), id, payload);
|
|
21
|
+
}
|
|
22
|
+
toMessageData() {
|
|
23
|
+
return serializeToBuffer([
|
|
24
|
+
bigintToUInt64BE(BigInt(this.publishTime.getTime())),
|
|
25
|
+
this.id,
|
|
26
|
+
serializeToBuffer(this.payload.length, this.payload)
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
1
30
|
/**
|
|
2
31
|
* Gossipable
|
|
3
32
|
*
|
|
4
33
|
* Any class which extends gossipable will be able to be Gossiped over the p2p network
|
|
5
34
|
*/ export class Gossipable {
|
|
35
|
+
cachedId;
|
|
6
36
|
/** p2p Topic
|
|
7
37
|
*
|
|
8
38
|
* - The p2p topic identifier, this determines how the message is handled
|
|
9
39
|
*/ static p2pTopic;
|
|
40
|
+
/** p2p Message Identifier
|
|
41
|
+
*
|
|
42
|
+
* - A digest of the message information, this key is used for deduplication
|
|
43
|
+
*/ async p2pMessageIdentifier() {
|
|
44
|
+
if (this.cachedId) {
|
|
45
|
+
return this.cachedId;
|
|
46
|
+
}
|
|
47
|
+
this.cachedId = await this.generateP2PMessageIdentifier();
|
|
48
|
+
return this.cachedId;
|
|
49
|
+
}
|
|
50
|
+
toMessage() {
|
|
51
|
+
return this.toBuffer();
|
|
52
|
+
}
|
|
10
53
|
}
|
package/dest/tx/profiling.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ZodFor } from '@aztec/foundation/schemas';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import type { AbiDecoded } from '../abi/decoder.js';
|
|
3
4
|
import { type PrivateExecutionStep } from '../kernel/private_kernel_prover_output.js';
|
|
4
5
|
type FunctionTiming = {
|
|
5
6
|
functionName: string;
|
|
@@ -98,5 +99,12 @@ export declare class TxProfileResult {
|
|
|
98
99
|
static get schema(): ZodFor<TxProfileResult>;
|
|
99
100
|
static random(): TxProfileResult;
|
|
100
101
|
}
|
|
102
|
+
export declare class UtilitySimulationResult {
|
|
103
|
+
result: AbiDecoded;
|
|
104
|
+
timings?: SimulationTimings | undefined;
|
|
105
|
+
constructor(result: AbiDecoded, timings?: SimulationTimings | undefined);
|
|
106
|
+
static get schema(): ZodFor<UtilitySimulationResult>;
|
|
107
|
+
static random(): UtilitySimulationResult;
|
|
108
|
+
}
|
|
101
109
|
export {};
|
|
102
110
|
//# sourceMappingURL=profiling.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/tx/profiling.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/tx/profiling.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,E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MAAM,IAAI,uBAAuB;CAezC"}
|
package/dest/tx/profiling.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
1
2
|
import { optional } from '@aztec/foundation/schemas';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { PrivateExecutionStepSchema } from '../kernel/private_kernel_prover_output.js';
|
|
5
|
+
import { AbiDecodedSchema } from '../schemas/schemas.js';
|
|
4
6
|
const FunctionTimingSchema = z.object({
|
|
5
7
|
functionName: z.string(),
|
|
6
8
|
time: z.number()
|
|
@@ -64,3 +66,32 @@ export class TxProfileResult {
|
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
68
|
}
|
|
69
|
+
export class UtilitySimulationResult {
|
|
70
|
+
result;
|
|
71
|
+
timings;
|
|
72
|
+
constructor(result, timings){
|
|
73
|
+
this.result = result;
|
|
74
|
+
this.timings = timings;
|
|
75
|
+
}
|
|
76
|
+
static get schema() {
|
|
77
|
+
return z.object({
|
|
78
|
+
result: AbiDecodedSchema,
|
|
79
|
+
timings: optional(SimulationTimingsSchema)
|
|
80
|
+
}).transform(({ result, timings })=>new UtilitySimulationResult(result, timings));
|
|
81
|
+
}
|
|
82
|
+
static random() {
|
|
83
|
+
return new UtilitySimulationResult(Fr.random().toBigInt(), {
|
|
84
|
+
sync: 1,
|
|
85
|
+
publicSimulation: 1,
|
|
86
|
+
validation: 1,
|
|
87
|
+
perFunction: [
|
|
88
|
+
{
|
|
89
|
+
functionName: 'random',
|
|
90
|
+
time: 1
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
unaccounted: 1,
|
|
94
|
+
total: 5
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
package/dest/tx/tx.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export declare class Tx extends Gossipable {
|
|
|
61
61
|
* An array of calldata for the enqueued public function calls and the teardown function call.
|
|
62
62
|
*/
|
|
63
63
|
publicFunctionCalldata: HashedValues[]);
|
|
64
|
-
|
|
64
|
+
generateP2PMessageIdentifier(): Promise<Buffer32>;
|
|
65
65
|
hasPublicCalls(): boolean;
|
|
66
66
|
numberOfPublicCalls(): number;
|
|
67
67
|
getNonRevertiblePublicCallRequestsWithCalldata(): PublicCallRequestWithCalldata[];
|
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,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,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,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,6BAA6B,EA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M,CAAA;CAAE,CAAC"}
|
package/dest/tx/tx.js
CHANGED
|
@@ -35,7 +35,7 @@ import { TxHash } from './tx_hash.js';
|
|
|
35
35
|
super(), this.data = data, this.clientIvcProof = clientIvcProof, this.contractClassLogs = contractClassLogs, this.publicFunctionCalldata = publicFunctionCalldata;
|
|
36
36
|
}
|
|
37
37
|
// Gossipable method
|
|
38
|
-
async
|
|
38
|
+
async generateP2PMessageIdentifier() {
|
|
39
39
|
return new Buffer32((await this.getTxHash()).toBuffer());
|
|
40
40
|
}
|
|
41
41
|
hasPublicCalls() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.86.0-nightly.
|
|
3
|
+
"version": "0.86.0-nightly.20250514",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -66,13 +66,14 @@
|
|
|
66
66
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@aztec/bb.js": "0.86.0-nightly.
|
|
70
|
-
"@aztec/blob-lib": "0.86.0-nightly.
|
|
71
|
-
"@aztec/constants": "0.86.0-nightly.
|
|
72
|
-
"@aztec/ethereum": "0.86.0-nightly.
|
|
73
|
-
"@aztec/foundation": "0.86.0-nightly.
|
|
74
|
-
"@aztec/noir-noirc_abi": "0.86.0-nightly.
|
|
69
|
+
"@aztec/bb.js": "0.86.0-nightly.20250514",
|
|
70
|
+
"@aztec/blob-lib": "0.86.0-nightly.20250514",
|
|
71
|
+
"@aztec/constants": "0.86.0-nightly.20250514",
|
|
72
|
+
"@aztec/ethereum": "0.86.0-nightly.20250514",
|
|
73
|
+
"@aztec/foundation": "0.86.0-nightly.20250514",
|
|
74
|
+
"@aztec/noir-noirc_abi": "0.86.0-nightly.20250514",
|
|
75
75
|
"@google-cloud/storage": "^7.15.0",
|
|
76
|
+
"axios": "^1.9.0",
|
|
76
77
|
"lodash.chunk": "^4.2.0",
|
|
77
78
|
"lodash.isequal": "^4.5.0",
|
|
78
79
|
"lodash.omit": "^4.5.0",
|
|
@@ -216,31 +216,17 @@ function generateFunctionArtifact(
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
function getFunctionType(fn: NoirCompiledContractFunction): FunctionType {
|
|
219
|
-
if (fn.custom_attributes.
|
|
219
|
+
if (fn.custom_attributes.includes(AZTEC_PRIVATE_ATTRIBUTE)) {
|
|
220
220
|
return FunctionType.PRIVATE;
|
|
221
|
-
} else if (fn.custom_attributes.
|
|
221
|
+
} else if (fn.custom_attributes.includes(AZTEC_PUBLIC_ATTRIBUTE)) {
|
|
222
222
|
return FunctionType.PUBLIC;
|
|
223
|
-
} else if (fn.custom_attributes.
|
|
223
|
+
} else if (fn.custom_attributes.includes(AZTEC_UTILITY_ATTRIBUTE)) {
|
|
224
224
|
return FunctionType.UTILITY;
|
|
225
225
|
} else {
|
|
226
226
|
throw new Error(`Invalid function type for a noir contract function ${fn.name}`);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
// TODO(https://github.com/noir-lang/noir/issues/7912): Replace the above function with this one once the linked issue
|
|
231
|
-
// is fixed.
|
|
232
|
-
// function getFunctionType(fn: NoirCompiledContractFunction): FunctionType {
|
|
233
|
-
// if (fn.custom_attributes.includes(AZTEC_PRIVATE_ATTRIBUTE)) {
|
|
234
|
-
// return FunctionType.PRIVATE;
|
|
235
|
-
// } else if (fn.custom_attributes.includes(AZTEC_PUBLIC_ATTRIBUTE)) {
|
|
236
|
-
// return FunctionType.PUBLIC;
|
|
237
|
-
// } else if (fn.custom_attributes.includes(AZTEC_UTILITY_ATTRIBUTE)) {
|
|
238
|
-
// return FunctionType.UTILITY;
|
|
239
|
-
// } else {
|
|
240
|
-
// throw new Error(`Invalid function type for a noir contract function ${fn.name}`);
|
|
241
|
-
// }
|
|
242
|
-
// }
|
|
243
|
-
|
|
244
230
|
/**
|
|
245
231
|
* Returns true if the first parameter is kernel function inputs.
|
|
246
232
|
*
|
package/src/file-store/http.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
3
3
|
|
|
4
|
+
import axios, { type AxiosInstance, type AxiosRequestConfig, type AxiosResponse } from 'axios';
|
|
4
5
|
import { createWriteStream } from 'fs';
|
|
5
6
|
import { mkdir } from 'fs/promises';
|
|
6
7
|
import { dirname } from 'path';
|
|
@@ -10,13 +11,15 @@ import { finished } from 'stream/promises';
|
|
|
10
11
|
import type { ReadOnlyFileStore } from './interface.js';
|
|
11
12
|
|
|
12
13
|
export class HttpFileStore implements ReadOnlyFileStore {
|
|
13
|
-
private readonly
|
|
14
|
+
private readonly axiosInstance: AxiosInstance;
|
|
15
|
+
private readonly fetch: <T>(config: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
|
|
14
16
|
|
|
15
17
|
constructor(private readonly baseUrl: string, private readonly log: Logger = createLogger('stdlib:http-file-store')) {
|
|
16
|
-
this.
|
|
18
|
+
this.axiosInstance = axios.create();
|
|
19
|
+
this.fetch = async <T>(config: AxiosRequestConfig) => {
|
|
17
20
|
return await retry(
|
|
18
|
-
() =>
|
|
19
|
-
`Fetching ${
|
|
21
|
+
() => this.axiosInstance.request<T>(config),
|
|
22
|
+
`Fetching ${config.url}`,
|
|
20
23
|
makeBackoff([1, 1, 3]),
|
|
21
24
|
this.log,
|
|
22
25
|
/*failSilently=*/ true,
|
|
@@ -26,30 +29,33 @@ export class HttpFileStore implements ReadOnlyFileStore {
|
|
|
26
29
|
|
|
27
30
|
public async read(pathOrUrl: string): Promise<Buffer> {
|
|
28
31
|
const url = this.getUrl(pathOrUrl);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return Buffer.from(
|
|
32
|
-
}
|
|
33
|
-
throw new Error(`Error fetching file from ${url}: ${
|
|
32
|
+
try {
|
|
33
|
+
const response = await this.fetch<ArrayBuffer>({ url, method: 'GET', responseType: 'arraybuffer' });
|
|
34
|
+
return Buffer.from(response.data);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
throw new Error(`Error fetching file from ${url}: ${error instanceof Error ? error.message : String(error)}`);
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
public async download(pathOrUrl: string, destPath: string): Promise<void> {
|
|
38
41
|
const url = this.getUrl(pathOrUrl);
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
try {
|
|
43
|
+
const response = await this.fetch<Readable>({ url, method: 'GET', responseType: 'stream' });
|
|
41
44
|
await mkdir(dirname(destPath), { recursive: true });
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
throw new Error(`Error fetching file from ${url}: ${response.statusText}`);
|
|
45
|
+
await finished(response.data.pipe(createWriteStream(destPath)));
|
|
46
|
+
} catch (error) {
|
|
47
|
+
throw new Error(`Error fetching file from ${url}: ${error instanceof Error ? error.message : String(error)}`);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
public async exists(pathOrUrl: string): Promise<boolean> {
|
|
50
52
|
const url = this.getUrl(pathOrUrl);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
try {
|
|
54
|
+
await this.fetch<unknown>({ url, method: 'HEAD' });
|
|
55
|
+
return true;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
private getUrl(path: string): string {
|
package/src/interfaces/pxe.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { SiblingPath } from '@aztec/foundation/trees';
|
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
8
|
import { type AbiType, AbiTypeSchema, type ContractArtifact, ContractArtifactSchema } from '../abi/abi.js';
|
|
9
|
-
import type { AbiDecoded } from '../abi/decoder.js';
|
|
10
9
|
import type { EventSelector } from '../abi/event_selector.js';
|
|
11
10
|
import { AuthWitness } from '../auth_witness/auth_witness.js';
|
|
12
11
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
@@ -38,7 +37,7 @@ import {
|
|
|
38
37
|
TxSimulationResult,
|
|
39
38
|
indexedTxSchema,
|
|
40
39
|
} from '../tx/index.js';
|
|
41
|
-
import { TxProfileResult } from '../tx/profiling.js';
|
|
40
|
+
import { TxProfileResult, UtilitySimulationResult } from '../tx/profiling.js';
|
|
42
41
|
import { TxProvingResult } from '../tx/proven_tx.js';
|
|
43
42
|
import {
|
|
44
43
|
type GetContractClassLogsResponse,
|
|
@@ -291,7 +290,7 @@ export interface PXE {
|
|
|
291
290
|
authwits?: AuthWitness[],
|
|
292
291
|
from?: AztecAddress,
|
|
293
292
|
scopes?: AztecAddress[],
|
|
294
|
-
): Promise<
|
|
293
|
+
): Promise<UtilitySimulationResult>;
|
|
295
294
|
|
|
296
295
|
/**
|
|
297
296
|
* Gets public logs based on the provided filter.
|
|
@@ -510,7 +509,7 @@ export const PXESchema: ApiSchemaFor<PXE> = {
|
|
|
510
509
|
optional(schemas.AztecAddress),
|
|
511
510
|
optional(z.array(schemas.AztecAddress)),
|
|
512
511
|
)
|
|
513
|
-
.returns(
|
|
512
|
+
.returns(UtilitySimulationResult.schema),
|
|
514
513
|
getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
|
|
515
514
|
getContractClassLogs: z.function().args(LogFilterSchema).returns(GetContractClassLogsResponseSchema),
|
|
516
515
|
getBlockNumber: z.function().returns(z.number()),
|
|
@@ -25,4 +25,14 @@ export class InboxLeaf {
|
|
|
25
25
|
static smallestIndexFromL2Block(l2block: bigint): bigint {
|
|
26
26
|
return (l2block - BigInt(INITIAL_L2_BLOCK_NUM)) * BigInt(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns the range of valid indices for a given L2 block.
|
|
31
|
+
* Start index is inclusive, end index is exclusive.
|
|
32
|
+
*/
|
|
33
|
+
static indexRangeFromL2Block(l2block: bigint): [bigint, bigint] {
|
|
34
|
+
const start = this.smallestIndexFromL2Block(l2block);
|
|
35
|
+
const end = start + BigInt(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
36
|
+
return [start, end];
|
|
37
|
+
}
|
|
28
38
|
}
|
|
@@ -53,7 +53,7 @@ export class BlockAttestation extends Gossipable {
|
|
|
53
53
|
.transform(obj => new BlockAttestation(obj.blockNumber, obj.payload, obj.signature));
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
override
|
|
56
|
+
override generateP2PMessageIdentifier(): Promise<Buffer32> {
|
|
57
57
|
return Promise.resolve(new BlockAttestationHash(keccak256(this.signature.toBuffer())));
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -49,7 +49,7 @@ export class BlockProposal extends Gossipable {
|
|
|
49
49
|
super();
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
override
|
|
52
|
+
override generateP2PMessageIdentifier(): Promise<Buffer32> {
|
|
53
53
|
return Promise.resolve(new BlockProposalHash(keccak256(this.signature.toBuffer())));
|
|
54
54
|
}
|
|
55
55
|
|
package/src/p2p/gossipable.ts
CHANGED
|
@@ -1,13 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
|
+
import { BufferReader, bigintToUInt64BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
2
3
|
|
|
3
4
|
import type { TopicType } from './topic_type.js';
|
|
4
5
|
|
|
6
|
+
export class P2PMessage {
|
|
7
|
+
constructor(public readonly publishTime: Date, public readonly id: Buffer32, public readonly payload: Buffer) {}
|
|
8
|
+
|
|
9
|
+
static async fromGossipable(message: Gossipable): Promise<P2PMessage> {
|
|
10
|
+
return new P2PMessage(new Date(), await message.p2pMessageIdentifier(), message.toBuffer());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static fromMessageData(messageData: Buffer): P2PMessage {
|
|
14
|
+
const reader = new BufferReader(messageData);
|
|
15
|
+
const publishTime = reader.readUInt64();
|
|
16
|
+
const id = Buffer32.fromBuffer(reader);
|
|
17
|
+
const payload = reader.readBuffer();
|
|
18
|
+
return new P2PMessage(new Date(Number(publishTime)), id, payload);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
toMessageData(): Buffer {
|
|
22
|
+
return serializeToBuffer([
|
|
23
|
+
bigintToUInt64BE(BigInt(this.publishTime.getTime())),
|
|
24
|
+
this.id,
|
|
25
|
+
serializeToBuffer(this.payload.length, this.payload),
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
5
30
|
/**
|
|
6
31
|
* Gossipable
|
|
7
32
|
*
|
|
8
33
|
* Any class which extends gossipable will be able to be Gossiped over the p2p network
|
|
9
34
|
*/
|
|
10
35
|
export abstract class Gossipable {
|
|
36
|
+
private cachedId: Buffer32 | undefined;
|
|
11
37
|
/** p2p Topic
|
|
12
38
|
*
|
|
13
39
|
* - The p2p topic identifier, this determines how the message is handled
|
|
@@ -18,7 +44,15 @@ export abstract class Gossipable {
|
|
|
18
44
|
*
|
|
19
45
|
* - A digest of the message information, this key is used for deduplication
|
|
20
46
|
*/
|
|
21
|
-
|
|
47
|
+
async p2pMessageIdentifier(): Promise<Buffer32> {
|
|
48
|
+
if (this.cachedId) {
|
|
49
|
+
return this.cachedId;
|
|
50
|
+
}
|
|
51
|
+
this.cachedId = await this.generateP2PMessageIdentifier();
|
|
52
|
+
return this.cachedId;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
abstract generateP2PMessageIdentifier(): Promise<Buffer32>;
|
|
22
56
|
|
|
23
57
|
/** To Buffer
|
|
24
58
|
*
|
|
@@ -26,6 +60,10 @@ export abstract class Gossipable {
|
|
|
26
60
|
*/
|
|
27
61
|
abstract toBuffer(): Buffer;
|
|
28
62
|
|
|
63
|
+
toMessage(): Buffer {
|
|
64
|
+
return this.toBuffer();
|
|
65
|
+
}
|
|
66
|
+
|
|
29
67
|
/**
|
|
30
68
|
* Get the size of the gossipable object.
|
|
31
69
|
*
|
package/src/tx/profiling.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
1
2
|
import { type ZodFor, optional } from '@aztec/foundation/schemas';
|
|
2
3
|
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
|
|
6
|
+
import type { AbiDecoded } from '../abi/decoder.js';
|
|
5
7
|
import { type PrivateExecutionStep, PrivateExecutionStepSchema } from '../kernel/private_kernel_prover_output.js';
|
|
8
|
+
import { AbiDecodedSchema } from '../schemas/schemas.js';
|
|
6
9
|
|
|
7
10
|
type FunctionTiming = {
|
|
8
11
|
functionName: string;
|
|
@@ -86,3 +89,32 @@ export class TxProfileResult {
|
|
|
86
89
|
);
|
|
87
90
|
}
|
|
88
91
|
}
|
|
92
|
+
|
|
93
|
+
export class UtilitySimulationResult {
|
|
94
|
+
constructor(public result: AbiDecoded, public timings?: SimulationTimings) {}
|
|
95
|
+
|
|
96
|
+
static get schema(): ZodFor<UtilitySimulationResult> {
|
|
97
|
+
return z
|
|
98
|
+
.object({
|
|
99
|
+
result: AbiDecodedSchema,
|
|
100
|
+
timings: optional(SimulationTimingsSchema),
|
|
101
|
+
})
|
|
102
|
+
.transform(({ result, timings }) => new UtilitySimulationResult(result, timings));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static random(): UtilitySimulationResult {
|
|
106
|
+
return new UtilitySimulationResult(Fr.random().toBigInt(), {
|
|
107
|
+
sync: 1,
|
|
108
|
+
publicSimulation: 1,
|
|
109
|
+
validation: 1,
|
|
110
|
+
perFunction: [
|
|
111
|
+
{
|
|
112
|
+
functionName: 'random',
|
|
113
|
+
time: 1,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
unaccounted: 1,
|
|
117
|
+
total: 5,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
package/src/tx/tx.ts
CHANGED
|
@@ -54,7 +54,7 @@ export class Tx extends Gossipable {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// Gossipable method
|
|
57
|
-
override async
|
|
57
|
+
override async generateP2PMessageIdentifier(): Promise<Buffer32> {
|
|
58
58
|
return new Buffer32((await this.getTxHash()).toBuffer());
|
|
59
59
|
}
|
|
60
60
|
|