@aztec/stdlib 0.0.1-commit.321f6a9 → 0.0.1-commit.330febf
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/abi.d.ts +25 -7
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +11 -2
- package/dest/abi/contract_artifact.js +9 -11
- package/dest/abi/decoder.d.ts +12 -5
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +18 -21
- package/dest/abi/function_call.d.ts +17 -8
- package/dest/abi/function_call.d.ts.map +1 -1
- package/dest/abi/function_call.js +28 -9
- package/dest/avm/avm.d.ts +212 -211
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +3 -1
- package/dest/avm/avm_proving_request.d.ts +70 -70
- package/dest/block/l2_block_source.d.ts +1 -1
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +6 -2
- package/dest/block/l2_block_stream/interfaces.d.ts +7 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -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 +47 -20
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +9 -4
- package/dest/config/node-rpc-config.d.ts +1 -1
- package/dest/config/node-rpc-config.d.ts.map +1 -1
- package/dest/config/node-rpc-config.js +1 -1
- package/dest/contract/artifact_hash.d.ts +2 -2
- package/dest/contract/artifact_hash.d.ts.map +1 -1
- package/dest/contract/artifact_hash.js +10 -2
- package/dest/interfaces/api_limit.d.ts +6 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +3 -0
- package/dest/interfaces/aztec-node-admin.d.ts +2 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +7 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/interfaces/tx_provider.d.ts +5 -1
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/logs/logs_query.d.ts +2 -2
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +1 -1
- package/dest/tx/hashed_values.d.ts +7 -1
- package/dest/tx/hashed_values.d.ts.map +1 -1
- package/dest/tx/hashed_values.js +9 -1
- package/dest/tx/offchain_effect.js +1 -1
- package/dest/tx/simulated_tx.d.ts +1 -1
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +7 -2
- package/dest/tx/tx.d.ts +8 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +9 -3
- package/dest/validators/errors.d.ts +16 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +12 -0
- package/package.json +8 -8
- package/src/abi/abi.ts +24 -4
- package/src/abi/contract_artifact.ts +7 -7
- package/src/abi/decoder.ts +20 -24
- package/src/abi/function_call.ts +19 -7
- package/src/avm/avm.ts +4 -1
- package/src/block/l2_block_source.ts +14 -2
- package/src/block/l2_block_stream/interfaces.ts +6 -4
- package/src/block/l2_block_stream/l2_block_stream.ts +58 -21
- package/src/block/test/l2_tips_store_test_suite.ts +5 -0
- package/src/config/node-rpc-config.ts +2 -1
- package/src/contract/artifact_hash.ts +15 -3
- package/src/interfaces/api_limit.ts +5 -0
- package/src/interfaces/configs.ts +6 -0
- package/src/interfaces/tx_provider.ts +4 -0
- package/src/kernel/private_kernel_reset_dimensions.ts +1 -1
- package/src/logs/logs_query.ts +2 -2
- package/src/tx/hashed_values.ts +11 -6
- package/src/tx/offchain_effect.ts +1 -1
- package/src/tx/simulated_tx.ts +13 -2
- package/src/tx/tx.ts +19 -3
- package/src/validators/errors.ts +17 -0
package/dest/tx/tx.d.ts
CHANGED
|
@@ -13,6 +13,13 @@ import type { TxStats } from '../stats/stats.js';
|
|
|
13
13
|
import { HashedValues } from './hashed_values.js';
|
|
14
14
|
import { PublicCallRequestWithCalldata } from './public_call_request_with_calldata.js';
|
|
15
15
|
import { TxHash } from './tx_hash.js';
|
|
16
|
+
/**
|
|
17
|
+
* Upper bound on the calldata entries a tx can carry: one per enqueued call, plus one for the teardown call.
|
|
18
|
+
* The revertible and non-revertible call request arrays are each sized `MAX_ENQUEUED_CALLS_PER_TX`, but the
|
|
19
|
+
* private tail circuit fills them by partitioning a single array of that size, so their lengths sum to it. The
|
|
20
|
+
* teardown request is propagated separately and can only be set once.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MAX_PUBLIC_FUNCTION_CALLDATA_PER_TX: number;
|
|
16
23
|
/**
|
|
17
24
|
* The interface of an L2 transaction.
|
|
18
25
|
*/
|
|
@@ -171,4 +178,4 @@ export declare class TxArray extends Array<Tx> {
|
|
|
171
178
|
toBuffer(): Buffer;
|
|
172
179
|
toBuffer(sink: BufferSink): void;
|
|
173
180
|
}
|
|
174
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
181
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eC90eC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEVBQUUsS0FBSyxZQUFZLEVBQVksTUFBTSwwQkFBMEIsQ0FBQztBQUN2RSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDeEQsT0FBTyxFQUNMLFlBQVksRUFDWixVQUFVLEVBSVgsTUFBTSw2QkFBNkIsQ0FBQztBQUNyQyxPQUFPLEVBQ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FDSCxZQUFZLElBQUksRUFBRSxDQUVqQjtJQUVEOzs7O09BSUc7SUFDSCxNQUFNLENBQUMsTUFBTSxDQUFDLElBQUksR0FBRTtRQUFFLFdBQVcsQ0FBQyxFQUFFLE9BQU8sQ0FBQztRQUFDLE1BQU0sQ0FBQyxFQUFFLE1BQU0sR0FBRyxNQUFNLENBQUE7S0FBTyxHQUFHLEVBQUUsQ0FRaEY7SUFFRCxvR0FBb0c7SUFDdkYsYUFBYSxJQUFJLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FHNUM7Q0FTRjtBQUVEOztHQUVHO0FBQ0gscUJBQWEsT0FBUSxTQUFRLEtBQUssQ0FBQyxFQUFFLENBQUM7SUFDcEMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLFlBQVksR0FBRyxPQUFPLENBUXhEO0lBRU0sUUFBUSxJQUFJLE1BQU0sQ0FBQztJQUNuQixRQUFRLENBQUMsSUFBSSxFQUFFLFVBQVUsR0FBRyxJQUFJLENBQUM7Q0FPekMifQ==
|
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":"
|
|
1
|
+
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/tx/tx.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,YAAY,EAAY,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,UAAU,EAIX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,yBAAyB,CAAC;AAIlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,E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IAAI,MAAM,CAKhB;IAED;;;;OAIG;IACH,+BAA+B,IAAI,MAAM,CAcxC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,UAAO,GAAG,EAAE,CAQ1C;IAED;;;;;OAKG;IACH,YAAY,IAAI,EAAE,CAEjB;IAED;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,GAAG,EAAE,CAQhF;IAED,oGAAoG;IACvF,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAG5C;CASF;AAED;;GAEG;AACH,qBAAa,OAAQ,SAAQ,KAAK,CAAC,EAAE,CAAC;IACpC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,OAAO,CAQxD;IAEM,QAAQ,IAAI,MAAM,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;CAOzC"}
|
package/dest/tx/tx.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DA_GAS_PER_FIELD, TX_DA_GAS_OVERHEAD } from '@aztec/constants';
|
|
1
|
+
import { DA_GAS_PER_FIELD, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_TX, MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS, TX_DA_GAS_OVERHEAD } from '@aztec/constants';
|
|
2
2
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
3
|
import { BufferReader, BufferSink, serializeArrayOfBufferableToVector, serializeArrayToSink, serializeToSink } from '@aztec/foundation/serialize';
|
|
4
4
|
import { unfreeze } from '@aztec/foundation/types';
|
|
@@ -18,6 +18,12 @@ import { TxHash } from './tx_hash.js';
|
|
|
18
18
|
// exceed this still serialize correctly — the sink falls back to its standard doubling growth — just
|
|
19
19
|
// with the existing cost.
|
|
20
20
|
const TX_SINK_PRESIZE_BYTES = 131072;
|
|
21
|
+
/**
|
|
22
|
+
* Upper bound on the calldata entries a tx can carry: one per enqueued call, plus one for the teardown call.
|
|
23
|
+
* The revertible and non-revertible call request arrays are each sized `MAX_ENQUEUED_CALLS_PER_TX`, but the
|
|
24
|
+
* private tail circuit fills them by partitioning a single array of that size, so their lengths sum to it. The
|
|
25
|
+
* teardown request is propagated separately and can only be set once.
|
|
26
|
+
*/ export const MAX_PUBLIC_FUNCTION_CALLDATA_PER_TX = MAX_ENQUEUED_CALLS_PER_TX + 1;
|
|
21
27
|
/**
|
|
22
28
|
* The interface of an L2 transaction.
|
|
23
29
|
*/ // docs:start:tx_class
|
|
@@ -122,8 +128,8 @@ export class Tx extends Gossipable {
|
|
|
122
128
|
return z.object({
|
|
123
129
|
data: PrivateKernelTailCircuitPublicInputs.schema,
|
|
124
130
|
chonkProof: ChonkProof.schema,
|
|
125
|
-
contractClassLogFields: z.array(ContractClassLogFields.schema),
|
|
126
|
-
publicFunctionCalldata: z.array(HashedValues.
|
|
131
|
+
contractClassLogFields: z.array(ContractClassLogFields.schema).max(MAX_CONTRACT_CLASS_LOGS_PER_TX),
|
|
132
|
+
publicFunctionCalldata: z.array(HashedValues.schemaFor(MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS)).max(MAX_PUBLIC_FUNCTION_CALLDATA_PER_TX)
|
|
127
133
|
}).transform(Tx.create);
|
|
128
134
|
}
|
|
129
135
|
static async computeTxHash(fields) {
|
|
@@ -16,6 +16,21 @@ export declare class AttestationTimeoutError extends ValidatorError {
|
|
|
16
16
|
export declare class TransactionsNotAvailableError extends ValidatorError {
|
|
17
17
|
constructor(txHashes: TxHash[]);
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Thrown when a tx carried in a block proposal fails minimum integrity validation (metadata, size, data,
|
|
21
|
+
* contract instances, or proof). The proposer signs both the tx hashes and the tx objects, so this is
|
|
22
|
+
* proposer misbehavior rather than a local failure, and callers classify it as an invalid block proposal.
|
|
23
|
+
*/
|
|
24
|
+
export declare class InvalidBlockProposalTxsError extends ValidatorError {
|
|
25
|
+
readonly invalidTxs: {
|
|
26
|
+
txHash: TxHash;
|
|
27
|
+
reasons: string[];
|
|
28
|
+
}[];
|
|
29
|
+
constructor(invalidTxs: {
|
|
30
|
+
txHash: TxHash;
|
|
31
|
+
reasons: string[];
|
|
32
|
+
}[]);
|
|
33
|
+
}
|
|
19
34
|
export declare class FailedToReExecuteTransactionsError extends ValidatorError {
|
|
20
35
|
constructor(txHashes: TxHash[]);
|
|
21
36
|
}
|
|
@@ -35,4 +50,4 @@ export declare class ReExFailedTxsError extends ValidatorError {
|
|
|
35
50
|
export declare class ReExTimeoutError extends ValidatorError {
|
|
36
51
|
constructor();
|
|
37
52
|
}
|
|
38
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdmFsaWRhdG9ycy9lcnJvcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFL0MscUJBQWEsY0FBZSxTQUFRLEtBQUs7SUFDdkMsWUFBWSxPQUFPLEVBQUUsTUFBTSxFQUUxQjtDQUNGO0FBRUQscUJBQWEsK0JBQWdDLFNBQVEsY0FBYztJQUNqRSxjQUVDO0NBQ0Y7QUFFRCxxQkFBYSx1QkFBd0IsU0FBUSxjQUFjO2FBRXZDL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B,iBAAiB,EAAE,EAAE;IAFvC,YACkB,mBAAmB,EAAE,EAAE,EACvB,iBAAiB,EAAE,EAAE,EAGtC;CACF;AAED,qBAAa,sBAAuB,SAAQ,cAAc;aAEtC,mBAAmB,EAAE,EAAE;aACvB,iBAAiB,EAAE,EAAE;IAFvC,YACkB,mBAAmB,EAAE,EAAE,EACvB,iBAAiB,EAAE,EAAE,EAGtC;CACF;AAED,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,YAAY,YAAY,EAAE,MAAM,EAE/B;CACF;AAED,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,cAEC;CACF"}
|
|
@@ -21,6 +21,18 @@ export class TransactionsNotAvailableError extends ValidatorError {
|
|
|
21
21
|
super(`Transactions not available: ${txHashes.join(', ')}`);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Thrown when a tx carried in a block proposal fails minimum integrity validation (metadata, size, data,
|
|
26
|
+
* contract instances, or proof). The proposer signs both the tx hashes and the tx objects, so this is
|
|
27
|
+
* proposer misbehavior rather than a local failure, and callers classify it as an invalid block proposal.
|
|
28
|
+
*/ export class InvalidBlockProposalTxsError extends ValidatorError {
|
|
29
|
+
invalidTxs;
|
|
30
|
+
constructor(invalidTxs){
|
|
31
|
+
super(`Invalid txs in block proposal: ${invalidTxs.map(({ txHash, reasons })=>`${txHash} (${reasons.join(', ')})`).join('; ')}`), this.invalidTxs = invalidTxs;
|
|
32
|
+
// Set so `isErrorClass` can recognize this error across package instances, where `instanceof` fails.
|
|
33
|
+
this.name = 'InvalidBlockProposalTxsError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
24
36
|
export class FailedToReExecuteTransactionsError extends ValidatorError {
|
|
25
37
|
constructor(txHashes){
|
|
26
38
|
super(`Failed to re-execute transactions: ${txHashes.join(', ')}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.330febf",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -92,13 +92,13 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
95
|
-
"@aztec/bb.js": "0.0
|
|
96
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
97
|
-
"@aztec/constants": "0.0.1-commit.
|
|
98
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
99
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
100
|
-
"@aztec/l1-artifacts": "0.0
|
|
101
|
-
"@aztec/noir-noirc_abi": "0.0
|
|
95
|
+
"@aztec/bb.js": "6.0.0-nightly.20260807",
|
|
96
|
+
"@aztec/blob-lib": "0.0.1-commit.330febf",
|
|
97
|
+
"@aztec/constants": "0.0.1-commit.330febf",
|
|
98
|
+
"@aztec/ethereum": "0.0.1-commit.330febf",
|
|
99
|
+
"@aztec/foundation": "0.0.1-commit.330febf",
|
|
100
|
+
"@aztec/l1-artifacts": "6.0.0-nightly.20260807",
|
|
101
|
+
"@aztec/noir-noirc_abi": "6.0.0-nightly.20260807",
|
|
102
102
|
"@google-cloud/storage": "^7.15.0",
|
|
103
103
|
"axios": "^1.15.1",
|
|
104
104
|
"json-stringify-deterministic": "1.0.12",
|
package/src/abi/abi.ts
CHANGED
|
@@ -190,14 +190,34 @@ export interface FunctionAbi {
|
|
|
190
190
|
isStatic: boolean;
|
|
191
191
|
/** Function parameters. */
|
|
192
192
|
parameters: ABIParameter[];
|
|
193
|
-
/** The
|
|
194
|
-
|
|
193
|
+
/** The type of the value the function returns, or undefined if it returns nothing. */
|
|
194
|
+
returnType?: AbiType;
|
|
195
|
+
/**
|
|
196
|
+
* The same type as `returnType`, as a list that is either:
|
|
197
|
+
* - a single entry, when the function returns something. Multiple return values are expressed as a single `tuple`
|
|
198
|
+
* type, so this never holds more than one entry.
|
|
199
|
+
* - empty, when the function returns nothing.
|
|
200
|
+
*
|
|
201
|
+
* @deprecated Read it through {@link getFunctionReturnType}.
|
|
202
|
+
*/
|
|
203
|
+
returnTypes?: AbiType[];
|
|
195
204
|
/** The types of the errors that the function can throw. */
|
|
196
205
|
errorTypes: Partial<Record<string, AbiErrorType>>;
|
|
197
206
|
/** Whether the function is flagged as an initializer. */
|
|
198
207
|
isInitializer: boolean;
|
|
199
208
|
}
|
|
200
209
|
|
|
210
|
+
/**
|
|
211
|
+
* The type a function returns, or undefined if it returns nothing. Falls back to the deprecated `returnTypes` so that
|
|
212
|
+
* artifacts serialized before `returnType` existed still resolve.
|
|
213
|
+
*/
|
|
214
|
+
export function getFunctionReturnType(abi: Pick<FunctionAbi, 'returnType' | 'returnTypes'>): AbiType | undefined {
|
|
215
|
+
if (abi.returnTypes !== undefined && abi.returnTypes.length > 1) {
|
|
216
|
+
throw new Error(`Expected at most one return type, got ${abi.returnTypes.length}`);
|
|
217
|
+
}
|
|
218
|
+
return abi.returnType ?? abi.returnTypes?.[0];
|
|
219
|
+
}
|
|
220
|
+
|
|
201
221
|
export const FunctionAbiSchema = z.object({
|
|
202
222
|
name: z.string(),
|
|
203
223
|
functionType: z.nativeEnum(FunctionType),
|
|
@@ -205,7 +225,8 @@ export const FunctionAbiSchema = z.object({
|
|
|
205
225
|
isStatic: z.boolean(),
|
|
206
226
|
isInitializer: z.boolean(),
|
|
207
227
|
parameters: z.array(z.object({ name: z.string(), type: AbiTypeSchema, visibility: z.enum(ABIParameterVisibility) })),
|
|
208
|
-
|
|
228
|
+
returnType: AbiTypeSchema.optional(),
|
|
229
|
+
returnTypes: z.array(AbiTypeSchema).optional(),
|
|
209
230
|
errorTypes: z.record(z.string(), AbiErrorTypeSchema.optional()),
|
|
210
231
|
}) satisfies z.ZodType<FunctionAbi>;
|
|
211
232
|
|
|
@@ -574,7 +595,6 @@ export function emptyFunctionAbi(): FunctionAbi {
|
|
|
574
595
|
isOnlySelf: false,
|
|
575
596
|
isStatic: false,
|
|
576
597
|
parameters: [],
|
|
577
|
-
returnTypes: [],
|
|
578
598
|
errorTypes: {},
|
|
579
599
|
isInitializer: false,
|
|
580
600
|
};
|
|
@@ -168,9 +168,9 @@ function generateFunctionAbi(fn: NoirCompiledContractFunction, contract: NoirCom
|
|
|
168
168
|
parameters = parameters.slice(1);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
let
|
|
171
|
+
let returnType: AbiType | undefined;
|
|
172
172
|
if (functionType === FunctionType.UTILITY) {
|
|
173
|
-
|
|
173
|
+
returnType = fn.abi.return_type?.abi_type;
|
|
174
174
|
} else {
|
|
175
175
|
const pathToFind = `${contract.name}::${fn.name}_abi`;
|
|
176
176
|
const abiStructs: AbiType[] = contract.outputs.structs['functions'];
|
|
@@ -182,10 +182,7 @@ function generateFunctionAbi(fn: NoirCompiledContractFunction, contract: NoirCom
|
|
|
182
182
|
throw new Error('Could not generate contract function artifact');
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
if (returnTypeField) {
|
|
187
|
-
returnTypes = [returnTypeField.type];
|
|
188
|
-
}
|
|
185
|
+
returnType = returnStruct.fields.find(field => field.name === 'return_type')?.type;
|
|
189
186
|
}
|
|
190
187
|
}
|
|
191
188
|
|
|
@@ -196,7 +193,10 @@ function generateFunctionAbi(fn: NoirCompiledContractFunction, contract: NoirCom
|
|
|
196
193
|
isStatic,
|
|
197
194
|
isInitializer: fn.custom_attributes.includes(AZTEC_INITIALIZER_ATTRIBUTE),
|
|
198
195
|
parameters,
|
|
199
|
-
|
|
196
|
+
returnType,
|
|
197
|
+
// Old consumers expect `returnTypes` property, not `returnType`. So we write both down for now, until we can
|
|
198
|
+
// safely remove the old version.
|
|
199
|
+
returnTypes: returnType ? [returnType] : [],
|
|
200
200
|
errorTypes: fn.abi.error_types,
|
|
201
201
|
...(fn.assert_messages ? { assertMessages: fn.assert_messages } : undefined),
|
|
202
202
|
};
|
package/src/abi/decoder.ts
CHANGED
|
@@ -32,17 +32,14 @@ export type AbiDecoded =
|
|
|
32
32
|
* Decodes values using a provided ABI.
|
|
33
33
|
*/
|
|
34
34
|
class AbiDecoder {
|
|
35
|
-
constructor(
|
|
36
|
-
private types: AbiType[],
|
|
37
|
-
private flattened: Fr[],
|
|
38
|
-
) {}
|
|
35
|
+
constructor(private flattened: Fr[]) {}
|
|
39
36
|
|
|
40
37
|
/**
|
|
41
|
-
* Decodes a single
|
|
42
|
-
* @param abiType - The type of the
|
|
43
|
-
* @returns The decoded
|
|
38
|
+
* Decodes a single value from field to the given type.
|
|
39
|
+
* @param abiType - The type of the value.
|
|
40
|
+
* @returns The decoded value.
|
|
44
41
|
*/
|
|
45
|
-
|
|
42
|
+
public decodeNext(abiType: AbiType): AbiDecoded {
|
|
46
43
|
switch (abiType.kind) {
|
|
47
44
|
case 'field':
|
|
48
45
|
return this.getNextField().toBigInt();
|
|
@@ -121,26 +118,25 @@ class AbiDecoder {
|
|
|
121
118
|
}
|
|
122
119
|
return field;
|
|
123
120
|
}
|
|
121
|
+
}
|
|
124
122
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
return this.types.map(type => this.decodeNext(type));
|
|
135
|
-
}
|
|
123
|
+
/**
|
|
124
|
+
* Decodes the single value a function returns, or undefined if it returns nothing. Multiple return values are expressed
|
|
125
|
+
* as one `tuple` type, so they decode through here too.
|
|
126
|
+
* @param type - The type the function returns.
|
|
127
|
+
* @param buffer - The flattened Field array to decode.
|
|
128
|
+
*/
|
|
129
|
+
export function decodeFromAbi(type: AbiType | undefined, buffer: Fr[]): AbiDecoded {
|
|
130
|
+
return type === undefined ? undefined : new AbiDecoder(buffer.slice()).decodeNext(type);
|
|
136
131
|
}
|
|
137
132
|
|
|
138
133
|
/**
|
|
139
|
-
* Decodes
|
|
140
|
-
*
|
|
134
|
+
* Decodes one value per given type, consumed from the buffer in order. Always returns one decoded value per type, so
|
|
135
|
+
* callers can index the result positionally. A function's arguments are encoded this way.
|
|
136
|
+
* @param types - The type of each value, in order.
|
|
141
137
|
* @param buffer - The flattened Field array to decode.
|
|
142
|
-
* @returns
|
|
143
138
|
*/
|
|
144
|
-
export function
|
|
145
|
-
|
|
139
|
+
export function decodeEachFromAbi(types: AbiType[], buffer: Fr[]): AbiDecoded[] {
|
|
140
|
+
const decoder = new AbiDecoder(buffer.slice());
|
|
141
|
+
return types.map(type => decoder.decodeNext(type));
|
|
146
142
|
}
|
package/src/abi/function_call.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
|
|
6
6
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
7
7
|
import { schemas } from '../schemas/index.js';
|
|
8
|
-
import { type AbiType, AbiTypeSchema, FunctionType } from './abi.js';
|
|
8
|
+
import { type AbiType, AbiTypeSchema, FunctionType, getFunctionReturnType } from './abi.js';
|
|
9
9
|
import { FunctionSelector } from './function_selector.js';
|
|
10
10
|
|
|
11
11
|
/** A request to call a function on a contract. */
|
|
@@ -25,8 +25,8 @@ export class FunctionCall {
|
|
|
25
25
|
public isStatic: boolean,
|
|
26
26
|
/** The encoded args */
|
|
27
27
|
public args: Fr[],
|
|
28
|
-
/** The
|
|
29
|
-
public
|
|
28
|
+
/** The type the call returns, for decoding, or undefined if it returns nothing */
|
|
29
|
+
public returnType?: AbiType,
|
|
30
30
|
) {}
|
|
31
31
|
|
|
32
32
|
static getFields(fields: FieldsOf<FunctionCall>) {
|
|
@@ -38,7 +38,7 @@ export class FunctionCall {
|
|
|
38
38
|
fields.hideMsgSender,
|
|
39
39
|
fields.isStatic,
|
|
40
40
|
fields.args,
|
|
41
|
-
fields.
|
|
41
|
+
fields.returnType,
|
|
42
42
|
] as const;
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -56,9 +56,22 @@ export class FunctionCall {
|
|
|
56
56
|
isStatic: z.boolean(),
|
|
57
57
|
hideMsgSender: z.boolean(),
|
|
58
58
|
args: z.array(schemas.Fr),
|
|
59
|
-
|
|
59
|
+
returnType: AbiTypeSchema.optional(),
|
|
60
|
+
// Old consumers send `returnTypes`, not `returnType`. So we accept both for now, until we can safely remove
|
|
61
|
+
// the old version.
|
|
62
|
+
returnTypes: z.array(AbiTypeSchema).optional(),
|
|
60
63
|
})
|
|
61
|
-
.transform(
|
|
64
|
+
.transform(({ returnType, returnTypes, ...fields }) =>
|
|
65
|
+
FunctionCall.from({ ...fields, returnType: getFunctionReturnType({ returnType, returnTypes }) }),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Serializes the deprecated `returnTypes` alongside `returnType`, so that peers that still require the old field can
|
|
71
|
+
* parse calls sent by this version.
|
|
72
|
+
*/
|
|
73
|
+
public toJSON() {
|
|
74
|
+
return { ...this, returnTypes: this.returnType ? [this.returnType] : [] };
|
|
62
75
|
}
|
|
63
76
|
|
|
64
77
|
public isPublicStatic(): boolean {
|
|
@@ -78,7 +91,6 @@ export class FunctionCall {
|
|
|
78
91
|
hideMsgSender: false,
|
|
79
92
|
isStatic: false,
|
|
80
93
|
args: [],
|
|
81
|
-
returnTypes: [],
|
|
82
94
|
});
|
|
83
95
|
}
|
|
84
96
|
}
|
package/src/avm/avm.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DEFAULT_MAX_DEBUG_LOG_MEMORY_READS } from '@aztec/constants';
|
|
2
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
2
|
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
3
|
|
|
@@ -1384,6 +1383,10 @@ export class PublicTxResult {
|
|
|
1384
1383
|
}
|
|
1385
1384
|
}
|
|
1386
1385
|
|
|
1386
|
+
// Excessive memory reads due to debug logging can open a DOS vector to nodes that perform public tx simulation for users.
|
|
1387
|
+
// This default limit (4MB) can be configured further by node runners via the `RPC_SIMULATE_PUBLIC_MAX_DEBUG_LOG_MEMORY_READS` environment variable.
|
|
1388
|
+
export const DEFAULT_MAX_DEBUG_LOG_MEMORY_READS = 125000;
|
|
1389
|
+
|
|
1387
1390
|
export class CollectionLimitsConfig {
|
|
1388
1391
|
constructor(
|
|
1389
1392
|
public readonly maxDebugLogMemoryReads: number,
|
|
@@ -19,6 +19,7 @@ import type { CheckpointData, ProposedCheckpointData, ProposedCheckpointInput }
|
|
|
19
19
|
import type { CheckpointInfo } from '../checkpoint/checkpoint_info.js';
|
|
20
20
|
import type { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
21
21
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
22
|
+
import { MAX_RPC_CHECKPOINTS_DATA_LEN } from '../interfaces/api_limit.js';
|
|
22
23
|
import type { L2ToL1MembershipWitness } from '../messaging/l2_to_l1_membership.js';
|
|
23
24
|
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
24
25
|
import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
|
|
@@ -89,9 +90,20 @@ export const CheckpointQuerySchema: z.ZodType<CheckpointQuery, unknown> = z.unio
|
|
|
89
90
|
z.object({ tag: z.union([z.literal('checkpointed'), z.literal('proven'), z.literal('finalized')]) }).strict(),
|
|
90
91
|
]);
|
|
91
92
|
|
|
93
|
+
const checkpointsQueryLimitSchema = () =>
|
|
94
|
+
z
|
|
95
|
+
.number()
|
|
96
|
+
.int()
|
|
97
|
+
.min(1)
|
|
98
|
+
.max(MAX_RPC_CHECKPOINTS_DATA_LEN, {
|
|
99
|
+
message: `limit must be at most ${MAX_RPC_CHECKPOINTS_DATA_LEN}`,
|
|
100
|
+
});
|
|
101
|
+
|
|
92
102
|
export const CheckpointsQuerySchema: z.ZodType<CheckpointsQuery, unknown> = z.union([
|
|
93
|
-
z.object({ from: CheckpointNumberSchema, limit:
|
|
94
|
-
z
|
|
103
|
+
z.object({ from: CheckpointNumberSchema, limit: checkpointsQueryLimitSchema() }).strict(),
|
|
104
|
+
z
|
|
105
|
+
.object({ fromSlot: SlotNumberSchema, limit: checkpointsQueryLimitSchema(), reverse: z.boolean().optional() })
|
|
106
|
+
.strict(),
|
|
95
107
|
z.object({ epoch: EpochNumberSchema }).strict(),
|
|
96
108
|
]);
|
|
97
109
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
|
|
3
|
+
import type { BlockHeader } from '../../tx/block_header.js';
|
|
3
4
|
import type { L2Block } from '../l2_block.js';
|
|
4
5
|
import type { CheckpointId, L2BlockId, L2TipId, L2Tips, LocalL2Tips } from '../l2_block_source.js';
|
|
5
6
|
|
|
@@ -81,13 +82,14 @@ export type L2BlockStreamEvent =
|
|
|
81
82
|
}
|
|
82
83
|
| /**
|
|
83
84
|
* Reports the new proposed tip of the chain. Emitted once per sync pass when the source's proposed tip differs
|
|
84
|
-
* from the pre-pass local one (downloads, a prune, or a thin tip movement).
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
85
|
+
* from the pre-pass local one (downloads, a prune, or a thin tip movement). In block mode the corresponding
|
|
86
|
+
* payloads also arrive via preceding `blocks-added` events, while in tips-only mode this is the sole signal that
|
|
87
|
+
* the proposed tip moved. Consumers that only track the proposed tip can ignore `blocks-added` entirely and
|
|
88
|
+
* anchor on this event instead.
|
|
88
89
|
*/ {
|
|
89
90
|
type: 'chain-proposed';
|
|
90
91
|
block: L2BlockId;
|
|
92
|
+
header: BlockHeader;
|
|
91
93
|
}
|
|
92
94
|
| /**
|
|
93
95
|
* Reports a new checkpointed tip. Emitted at most once per sync pass when the source's checkpointed tip
|
|
@@ -3,6 +3,8 @@ import { AbortError } from '@aztec/foundation/error';
|
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
5
|
|
|
6
|
+
import type { BlockHeader } from '../../tx/block_header.js';
|
|
7
|
+
import { BlockHash } from '../block_hash.js';
|
|
6
8
|
import type { L2Block } from '../l2_block.js';
|
|
7
9
|
import { type L2BlockId, type L2BlockSource, type LocalL2Tips, makeL2BlockId } from '../l2_block_source.js';
|
|
8
10
|
import {
|
|
@@ -100,6 +102,13 @@ export class L2BlockStream {
|
|
|
100
102
|
// Baseline for the chain-proposed event; captured before the local store mutates during the pass.
|
|
101
103
|
const prePassProposed = localTips.proposed;
|
|
102
104
|
|
|
105
|
+
// In tips-only mode there is no download loop to supply the chain-proposed event's header, so it must be
|
|
106
|
+
// fetched. Start the read now so it runs in parallel with the walk-back below.
|
|
107
|
+
const prefetch: ProposedHeaderPrefetch | undefined =
|
|
108
|
+
this.opts.tipsOnly && localBlockIdDiffers(prePassProposed, sourceTips.proposed)
|
|
109
|
+
? { hash: sourceTips.proposed.hash, header: this.getHeaderFromSource(sourceTips.proposed.hash) }
|
|
110
|
+
: undefined;
|
|
111
|
+
|
|
103
112
|
// Walk back to find a reorg, floored at the local finalized tip (a legitimate reorg can never reach it, since
|
|
104
113
|
// finalized means the proving tx is itself L1-finalized). Seed the cache with ONLY the proposed tip: a stale
|
|
105
114
|
// tier seed at a reorged height equals the local old-fork hash, faking agreement and stopping the walk above the
|
|
@@ -169,17 +178,29 @@ export class L2BlockStream {
|
|
|
169
178
|
}
|
|
170
179
|
|
|
171
180
|
// Pass atomicity: a prune mid-download leaves the source unable to serve the planned blocks, so the snapshot's
|
|
172
|
-
// tier tips may reference blocks the consumer never saw —
|
|
173
|
-
// has no download plan (the snapshot is one atomic getL2Tips read), so it always reconciles.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
181
|
+
// tier tips may reference blocks the consumer never saw — downloadBlocks aborts the pass in that case.
|
|
182
|
+
// Tips-only mode has no download plan (the snapshot is one atomic getL2Tips read), so it always reconciles.
|
|
183
|
+
const deliveredProposedHeader = this.opts.tipsOnly
|
|
184
|
+
? undefined
|
|
185
|
+
: await this.downloadBlocks(latestBlockNumber, sourceTips);
|
|
177
186
|
|
|
178
187
|
// End-of-pass reconciliation: chain-proposed fires against the pre-pass baseline (a post-prune re-read would
|
|
179
188
|
// equal the source tip and suppress it), then the tiers highest-to-lowest so the finalized <= proven <=
|
|
180
189
|
// checkpointed <= proposed invariant holds mid-pass.
|
|
181
190
|
if (localBlockIdDiffers(prePassProposed, sourceTips.proposed)) {
|
|
182
|
-
|
|
191
|
+
const availableHeader =
|
|
192
|
+
prefetch?.hash === sourceTips.proposed.hash ? await prefetch.header : deliveredProposedHeader;
|
|
193
|
+
const header = availableHeader ?? (await this.getHeaderFromSource(sourceTips.proposed.hash));
|
|
194
|
+
if (header === undefined) {
|
|
195
|
+
// Abort the pass rather than skip just this event: the later tier events must not get ahead of a
|
|
196
|
+
// proposed tip the consumer never received. Nothing advanced, so the next pass retries.
|
|
197
|
+
this.log.warn(`No header for the proposed tip; aborting this sync pass`, {
|
|
198
|
+
blockNumber: sourceTips.proposed.number,
|
|
199
|
+
blockHash: sourceTips.proposed.hash,
|
|
200
|
+
});
|
|
201
|
+
throw new AbortError();
|
|
202
|
+
}
|
|
203
|
+
await this.emitEvent({ type: 'chain-proposed', block: sourceTips.proposed, header });
|
|
183
204
|
}
|
|
184
205
|
|
|
185
206
|
const reconcileTips = pruned ? await this.localData.getL2Tips() : localTips;
|
|
@@ -222,13 +243,15 @@ export class L2BlockStream {
|
|
|
222
243
|
}
|
|
223
244
|
|
|
224
245
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* the
|
|
228
|
-
*
|
|
229
|
-
* the source no longer has a promised block, or served a fork at the proposed height mid-pass.
|
|
246
|
+
* Delivers every block from the agreed-on point through the advertised proposed tip as `blocks-added` events,
|
|
247
|
+
* aborting the pass when the source's own answers prove that tip is no longer real.
|
|
248
|
+
* @returns The delivered tip's header, so the caller can avoid a re-fetch; undefined when there was nothing to
|
|
249
|
+
* download (already at the tip, or startingBlock past it).
|
|
230
250
|
*/
|
|
231
|
-
private async downloadBlocks(
|
|
251
|
+
private async downloadBlocks(
|
|
252
|
+
latestBlockNumber: BlockNumber,
|
|
253
|
+
sourceTips: LocalL2Tips,
|
|
254
|
+
): Promise<BlockHeader | undefined> {
|
|
232
255
|
// The post-prune cursor: the highest block number both sides agree on. Block downloads resume from here.
|
|
233
256
|
let nextBlockNumber = latestBlockNumber + 1;
|
|
234
257
|
|
|
@@ -258,12 +281,12 @@ export class L2BlockStream {
|
|
|
258
281
|
if (blocks.length === 0) {
|
|
259
282
|
// The source no longer has a block the snapshot promised: the snapshot is provably stale, so report the plan
|
|
260
283
|
// incomplete and skip reconciliation this pass.
|
|
261
|
-
this.log.warn(`Block source returned no blocks for a promised range;
|
|
284
|
+
this.log.warn(`Block source returned no blocks for a promised range; aborting this sync pass`, {
|
|
262
285
|
from: nextBlockNumber,
|
|
263
286
|
limit,
|
|
264
287
|
sourceProposed: sourceTips.proposed.number,
|
|
265
288
|
});
|
|
266
|
-
|
|
289
|
+
throw new AbortError();
|
|
267
290
|
}
|
|
268
291
|
await this.emitEvent({ type: 'blocks-added', blocks });
|
|
269
292
|
lastDeliveredBlock = blocks.at(-1)!;
|
|
@@ -271,22 +294,23 @@ export class L2BlockStream {
|
|
|
271
294
|
}
|
|
272
295
|
|
|
273
296
|
if (lastDeliveredBlock === undefined) {
|
|
274
|
-
// Loop never ran
|
|
275
|
-
|
|
297
|
+
// Loop never ran (caught up before the plan started, or startingBlock past the tip, see A-1061), so nothing
|
|
298
|
+
// was downloaded that could disprove the snapshot.
|
|
299
|
+
return undefined;
|
|
276
300
|
}
|
|
277
301
|
|
|
278
|
-
//
|
|
279
|
-
//
|
|
302
|
+
// The block delivered at the proposed height must carry the snapshot's proposed hash; a different hash means a
|
|
303
|
+
// same-height fork swap happened mid-pass, so the snapshot is stale.
|
|
280
304
|
const deliveredHash = (await lastDeliveredBlock.hash()).toString();
|
|
281
305
|
if (deliveredHash !== sourceTips.proposed.hash) {
|
|
282
|
-
this.log.warn(`Delivered proposed-block hash differs from snapshot;
|
|
306
|
+
this.log.warn(`Delivered proposed-block hash differs from snapshot; aborting this sync pass`, {
|
|
283
307
|
blockNumber: lastDeliveredBlock.number,
|
|
284
308
|
deliveredHash,
|
|
285
309
|
snapshotHash: sourceTips.proposed.hash,
|
|
286
310
|
});
|
|
287
|
-
|
|
311
|
+
throw new AbortError();
|
|
288
312
|
}
|
|
289
|
-
return
|
|
313
|
+
return lastDeliveredBlock.header;
|
|
290
314
|
}
|
|
291
315
|
|
|
292
316
|
/**
|
|
@@ -342,6 +366,16 @@ export class L2BlockStream {
|
|
|
342
366
|
.then(hash => hash?.toString());
|
|
343
367
|
}
|
|
344
368
|
|
|
369
|
+
private getHeaderFromSource(hash: string): Promise<BlockHeader | undefined> {
|
|
370
|
+
return this.l2BlockSource
|
|
371
|
+
.getBlockData({ hash: BlockHash.fromString(hash) })
|
|
372
|
+
.then(data => data?.header)
|
|
373
|
+
.catch(err => {
|
|
374
|
+
this.log.error(`Failed to read header for block`, err, { blockHash: hash });
|
|
375
|
+
return undefined;
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
345
379
|
private async emitEvent(event: L2BlockStreamEvent) {
|
|
346
380
|
this.log.debug(
|
|
347
381
|
`Emitting ${event.type} (${
|
|
@@ -359,6 +393,9 @@ export class L2BlockStream {
|
|
|
359
393
|
}
|
|
360
394
|
}
|
|
361
395
|
|
|
396
|
+
/** A speculative proposed-tip header read, tagged with the hash it targets so a moved tip is detectable. */
|
|
397
|
+
type ProposedHeaderPrefetch = { hash: string; header: Promise<BlockHeader | undefined> };
|
|
398
|
+
|
|
362
399
|
class BlockHashCache {
|
|
363
400
|
private readonly cache: Map<number, string> = new Map();
|
|
364
401
|
|