@aztec/stdlib 4.0.0-nightly.20260120 → 4.0.0-nightly.20260122
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/block_hash.d.ts +7 -1
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +12 -0
- package/dest/block/l2_block_source.d.ts +13 -1
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +5 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +34 -22
- package/dest/config/node-rpc-config.js +1 -1
- package/dest/interfaces/api_limit.d.ts +2 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +1 -0
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +4 -2
- package/dest/interfaces/aztec-node-admin.d.ts +4 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +14 -5
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +2 -2
- package/dest/interfaces/l2_logs_source.d.ts +14 -5
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +10 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/proving-job.d.ts +166 -166
- package/dest/p2p/constants.d.ts +3 -0
- package/dest/p2p/constants.d.ts.map +1 -0
- package/dest/p2p/constants.js +2 -0
- package/dest/p2p/index.d.ts +2 -1
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +1 -0
- package/dest/tx/tx.d.ts +2 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +6 -3
- package/dest/tx/tx_receipt.d.ts +39 -11
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +44 -13
- package/dest/tx/validator/error_texts.d.ts +2 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +2 -0
- package/package.json +9 -9
- package/src/block/block_hash.ts +22 -0
- package/src/block/l2_block_source.ts +14 -0
- package/src/block/l2_block_stream/l2_block_stream.ts +40 -22
- package/src/config/node-rpc-config.ts +1 -1
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +4 -2
- package/src/interfaces/aztec-node.ts +19 -6
- package/src/interfaces/l2_logs_source.ts +17 -4
- package/src/interfaces/prover-client.ts +15 -0
- package/src/p2p/constants.ts +3 -0
- package/src/p2p/index.ts +1 -0
- package/src/tx/tx.ts +8 -9
- package/src/tx/tx_receipt.ts +72 -15
- package/src/tx/validator/error_texts.ts +3 -0
|
@@ -12,16 +12,29 @@ import type { GetContractClassLogsResponse, GetPublicLogsResponse } from './get_
|
|
|
12
12
|
*/
|
|
13
13
|
export interface L2LogsSource {
|
|
14
14
|
/**
|
|
15
|
-
* Gets
|
|
15
|
+
* Gets private logs that match any of the `tags`. For each tag, an array of matching logs is returned. An empty
|
|
16
16
|
* array implies no logs match that tag.
|
|
17
|
+
* @param tags - The tags to search for.
|
|
18
|
+
* @param page - The page number (0-indexed) for pagination.
|
|
19
|
+
* @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
|
|
20
|
+
* for a tag, the caller should fetch the next page to check for more logs.
|
|
17
21
|
*/
|
|
18
|
-
getPrivateLogsByTags(tags: SiloedTag[]): Promise<TxScopedL2Log[][]>;
|
|
22
|
+
getPrivateLogsByTags(tags: SiloedTag[], page?: number): Promise<TxScopedL2Log[][]>;
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
|
-
* Gets
|
|
25
|
+
* Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
|
|
22
26
|
* logs is returned. An empty array implies no logs match that tag.
|
|
27
|
+
* @param contractAddress - The contract address to search logs for.
|
|
28
|
+
* @param tags - The tags to search for.
|
|
29
|
+
* @param page - The page number (0-indexed) for pagination.
|
|
30
|
+
* @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
|
|
31
|
+
* for a tag, the caller should fetch the next page to check for more logs.
|
|
23
32
|
*/
|
|
24
|
-
getPublicLogsByTagsFromContract(
|
|
33
|
+
getPublicLogsByTagsFromContract(
|
|
34
|
+
contractAddress: AztecAddress,
|
|
35
|
+
tags: Tag[],
|
|
36
|
+
page?: number,
|
|
37
|
+
): Promise<TxScopedL2Log[][]>;
|
|
25
38
|
|
|
26
39
|
/**
|
|
27
40
|
* Gets public logs based on the provided filter.
|
|
@@ -17,6 +17,12 @@ export type ActualProverConfig = {
|
|
|
17
17
|
proverTestDelayMs: number;
|
|
18
18
|
/** If using realistic delays, what percentage of realistic times to apply. */
|
|
19
19
|
proverTestDelayFactor: number;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to abort pending proving jobs when the orchestrator is cancelled.
|
|
22
|
+
* When false (default), jobs remain in the broker queue and can be reused on restart/reorg.
|
|
23
|
+
* When true, jobs are explicitly cancelled with the broker, which prevents reuse.
|
|
24
|
+
*/
|
|
25
|
+
cancelJobsOnStop: boolean;
|
|
20
26
|
};
|
|
21
27
|
|
|
22
28
|
/**
|
|
@@ -43,6 +49,7 @@ export const ProverConfigSchema = zodFor<ProverConfig>()(
|
|
|
43
49
|
proverTestDelayFactor: z.number(),
|
|
44
50
|
proverAgentCount: z.number(),
|
|
45
51
|
failedProofStore: z.string().optional(),
|
|
52
|
+
cancelJobsOnStop: z.boolean(),
|
|
46
53
|
}),
|
|
47
54
|
);
|
|
48
55
|
|
|
@@ -85,6 +92,14 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
|
|
|
85
92
|
description:
|
|
86
93
|
'Store for failed proof inputs. Google cloud storage is only supported at the moment. Set this value as gs://bucket-name/path/to/store.',
|
|
87
94
|
},
|
|
95
|
+
cancelJobsOnStop: {
|
|
96
|
+
env: 'PROVER_CANCEL_JOBS_ON_STOP',
|
|
97
|
+
description:
|
|
98
|
+
'Whether to abort pending proving jobs when the orchestrator is cancelled. ' +
|
|
99
|
+
'When false (default), jobs remain in the broker queue and can be reused on restart/reorg. ' +
|
|
100
|
+
'When true, jobs are explicitly cancelled with the broker, which prevents reuse.',
|
|
101
|
+
...booleanConfigHelper(false),
|
|
102
|
+
},
|
|
88
103
|
};
|
|
89
104
|
|
|
90
105
|
function parseProverId(str?: string) {
|
package/src/p2p/index.ts
CHANGED
package/src/tx/tx.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
|
-
import { arraySerializedSizeOfNonEmpty } from '@aztec/foundation/collection';
|
|
3
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
3
|
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
5
4
|
import { BufferReader, serializeArrayOfBufferableToVector, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
@@ -247,7 +246,7 @@ export class Tx extends Gossipable {
|
|
|
247
246
|
contractClassLogSize: this.data.getEmittedContractClassLogsLength(),
|
|
248
247
|
|
|
249
248
|
proofSize: this.chonkProof.fields.length,
|
|
250
|
-
size: this.
|
|
249
|
+
size: this.getSize(),
|
|
251
250
|
|
|
252
251
|
feePaymentMethod:
|
|
253
252
|
// needsSetup? then we pay through a fee payment contract
|
|
@@ -255,13 +254,13 @@ export class Tx extends Gossipable {
|
|
|
255
254
|
};
|
|
256
255
|
}
|
|
257
256
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
257
|
+
private sizeCache: number | undefined;
|
|
258
|
+
|
|
259
|
+
getSize(): number {
|
|
260
|
+
if (this.sizeCache == undefined) {
|
|
261
|
+
this.sizeCache = this.toBuffer().length;
|
|
262
|
+
}
|
|
263
|
+
return this.sizeCache;
|
|
265
264
|
}
|
|
266
265
|
|
|
267
266
|
/**
|
package/src/tx/tx_receipt.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
2
|
|
|
4
3
|
import { z } from 'zod';
|
|
5
4
|
|
|
@@ -8,12 +7,28 @@ import { L2BlockHash } from '../block/block_hash.js';
|
|
|
8
7
|
import { type ZodFor, schemas } from '../schemas/schemas.js';
|
|
9
8
|
import { TxHash } from './tx_hash.js';
|
|
10
9
|
|
|
11
|
-
/**
|
|
12
|
-
* Possible status of a transaction.
|
|
13
|
-
*/
|
|
10
|
+
/** Block inclusion/finalization status. */
|
|
14
11
|
export enum TxStatus {
|
|
15
12
|
DROPPED = 'dropped',
|
|
16
13
|
PENDING = 'pending',
|
|
14
|
+
PROPOSED = 'proposed',
|
|
15
|
+
CHECKPOINTED = 'checkpointed',
|
|
16
|
+
PROVEN = 'proven',
|
|
17
|
+
FINALIZED = 'finalized', // TODO(#13569): Implement finalized status properly
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Tx status sorted by finalization progress. */
|
|
21
|
+
export const SortedTxStatuses: TxStatus[] = [
|
|
22
|
+
TxStatus.DROPPED,
|
|
23
|
+
TxStatus.PENDING,
|
|
24
|
+
TxStatus.PROPOSED,
|
|
25
|
+
TxStatus.CHECKPOINTED,
|
|
26
|
+
TxStatus.PROVEN,
|
|
27
|
+
TxStatus.FINALIZED,
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
/** Execution result - only set when tx is in a block. */
|
|
31
|
+
export enum TxExecutionResult {
|
|
17
32
|
SUCCESS = 'success',
|
|
18
33
|
APP_LOGIC_REVERTED = 'app_logic_reverted',
|
|
19
34
|
TEARDOWN_REVERTED = 'teardown_reverted',
|
|
@@ -30,10 +45,12 @@ export class TxReceipt {
|
|
|
30
45
|
constructor(
|
|
31
46
|
/** A unique identifier for a transaction. */
|
|
32
47
|
public txHash: TxHash,
|
|
33
|
-
/** The transaction's status. */
|
|
48
|
+
/** The transaction's block finalization status. */
|
|
34
49
|
public status: TxStatus,
|
|
50
|
+
/** The execution result of the transaction, only set when tx is in a block. */
|
|
51
|
+
public executionResult: TxExecutionResult | undefined,
|
|
35
52
|
/** Description of transaction error, if any. */
|
|
36
|
-
public error: string,
|
|
53
|
+
public error: string | undefined,
|
|
37
54
|
/** The transaction fee paid for the transaction. */
|
|
38
55
|
public transactionFee?: bigint,
|
|
39
56
|
/** The hash of the block containing the transaction. */
|
|
@@ -42,8 +59,38 @@ export class TxReceipt {
|
|
|
42
59
|
public blockNumber?: BlockNumber,
|
|
43
60
|
) {}
|
|
44
61
|
|
|
62
|
+
/** Returns true if the transaction was executed successfully. */
|
|
63
|
+
hasExecutionSucceeded(): boolean {
|
|
64
|
+
return this.executionResult === TxExecutionResult.SUCCESS;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Returns true if the transaction execution reverted. */
|
|
68
|
+
hasExecutionReverted(): boolean {
|
|
69
|
+
return this.executionResult !== undefined && this.executionResult !== TxExecutionResult.SUCCESS;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Returns true if the transaction has been included in a block (proposed, checkpointed, proven, or finalized). */
|
|
73
|
+
isMined(): boolean {
|
|
74
|
+
return (
|
|
75
|
+
this.status === TxStatus.PROPOSED ||
|
|
76
|
+
this.status === TxStatus.CHECKPOINTED ||
|
|
77
|
+
this.status === TxStatus.PROVEN ||
|
|
78
|
+
this.status === TxStatus.FINALIZED
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Returns true if the transaction is pending. */
|
|
83
|
+
isPending(): boolean {
|
|
84
|
+
return this.status === TxStatus.PENDING;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Returns true if the transaction was dropped. */
|
|
88
|
+
isDropped(): boolean {
|
|
89
|
+
return this.status === TxStatus.DROPPED;
|
|
90
|
+
}
|
|
91
|
+
|
|
45
92
|
static empty() {
|
|
46
|
-
return new TxReceipt(TxHash.zero(), TxStatus.DROPPED,
|
|
93
|
+
return new TxReceipt(TxHash.zero(), TxStatus.DROPPED, undefined, undefined);
|
|
47
94
|
}
|
|
48
95
|
|
|
49
96
|
static get schema(): ZodFor<TxReceipt> {
|
|
@@ -51,18 +98,28 @@ export class TxReceipt {
|
|
|
51
98
|
.object({
|
|
52
99
|
txHash: TxHash.schema,
|
|
53
100
|
status: z.nativeEnum(TxStatus),
|
|
54
|
-
|
|
101
|
+
executionResult: z.nativeEnum(TxExecutionResult).optional(),
|
|
102
|
+
error: z.string().optional(),
|
|
55
103
|
blockHash: L2BlockHash.schema.optional(),
|
|
56
104
|
blockNumber: BlockNumberSchema.optional(),
|
|
57
105
|
transactionFee: schemas.BigInt.optional(),
|
|
58
106
|
})
|
|
59
|
-
.transform(TxReceipt.from);
|
|
107
|
+
.transform(fields => TxReceipt.from(fields));
|
|
60
108
|
}
|
|
61
109
|
|
|
62
|
-
static from(fields:
|
|
110
|
+
static from(fields: {
|
|
111
|
+
txHash: TxHash;
|
|
112
|
+
status: TxStatus;
|
|
113
|
+
executionResult?: TxExecutionResult;
|
|
114
|
+
error?: string;
|
|
115
|
+
transactionFee?: bigint;
|
|
116
|
+
blockHash?: L2BlockHash;
|
|
117
|
+
blockNumber?: BlockNumber;
|
|
118
|
+
}) {
|
|
63
119
|
return new TxReceipt(
|
|
64
120
|
fields.txHash,
|
|
65
121
|
fields.status,
|
|
122
|
+
fields.executionResult,
|
|
66
123
|
fields.error,
|
|
67
124
|
fields.transactionFee,
|
|
68
125
|
fields.blockHash,
|
|
@@ -70,15 +127,15 @@ export class TxReceipt {
|
|
|
70
127
|
);
|
|
71
128
|
}
|
|
72
129
|
|
|
73
|
-
public static
|
|
130
|
+
public static executionResultFromRevertCode(revertCode: RevertCode): TxExecutionResult {
|
|
74
131
|
if (revertCode.equals(RevertCode.OK)) {
|
|
75
|
-
return
|
|
132
|
+
return TxExecutionResult.SUCCESS;
|
|
76
133
|
} else if (revertCode.equals(RevertCode.APP_LOGIC_REVERTED)) {
|
|
77
|
-
return
|
|
134
|
+
return TxExecutionResult.APP_LOGIC_REVERTED;
|
|
78
135
|
} else if (revertCode.equals(RevertCode.TEARDOWN_REVERTED)) {
|
|
79
|
-
return
|
|
136
|
+
return TxExecutionResult.TEARDOWN_REVERTED;
|
|
80
137
|
} else if (revertCode.equals(RevertCode.BOTH_REVERTED)) {
|
|
81
|
-
return
|
|
138
|
+
return TxExecutionResult.BOTH_REVERTED;
|
|
82
139
|
} else {
|
|
83
140
|
throw new Error(`Unknown revert code: ${revertCode.getCode()}`);
|
|
84
141
|
}
|
|
@@ -31,6 +31,9 @@ export const TX_ERROR_CONTRACT_CLASS_LOGS = 'Mismatched contract class logs';
|
|
|
31
31
|
export const TX_ERROR_CONTRACT_CLASS_LOG_SORTING = 'Incorrectly sorted contract class logs';
|
|
32
32
|
export const TX_ERROR_INCORRECT_HASH = 'Incorrect tx hash';
|
|
33
33
|
|
|
34
|
+
// Size
|
|
35
|
+
export const TX_ERROR_SIZE_ABOVE_LIMIT = 'Transaction size above size limit';
|
|
36
|
+
|
|
34
37
|
// Block header
|
|
35
38
|
export const TX_ERROR_BLOCK_HEADER = 'Block header not found';
|
|
36
39
|
|