@aztec/stdlib 3.0.0-nightly.20251216 → 3.0.0-nightly.20251217
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 +602 -4
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +7 -7
- package/dest/abi/function_selector.d.ts +2 -1
- package/dest/abi/function_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.js +7 -0
- package/dest/avm/avm.js +1 -1
- package/dest/block/checkpointed_l2_block.d.ts +267 -0
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -0
- package/dest/block/{published_l2_block.js → checkpointed_l2_block.js} +40 -4
- package/dest/block/index.d.ts +2 -2
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -1
- package/dest/block/l2_block_source.d.ts +62 -45
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.d.ts +2 -2
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +6 -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 +9 -1
- 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 +2 -5
- package/dest/checkpoint/checkpoint.d.ts +3 -2
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +16 -4
- package/dest/checkpoint/published_checkpoint.d.ts +14 -8
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +11 -1
- package/dest/contract/interfaces/contract_class.d.ts +11 -13
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +18 -18
- package/dest/contract/interfaces/contract_instance.d.ts +12 -13
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.js +5 -5
- package/dest/contract/interfaces/contract_instance_update.d.ts +6 -7
- package/dest/contract/interfaces/contract_instance_update.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance_update.js +5 -5
- package/dest/epoch-helpers/index.d.ts +1 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +3 -3
- package/dest/interfaces/allowed_element.d.ts +7 -8
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +3 -3
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +2 -2
- package/dest/interfaces/aztec-node-admin.d.ts +7 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +1 -1
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +1 -1
- package/dest/interfaces/configs.d.ts +13 -11
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +4 -3
- package/dest/interfaces/get_logs_response.d.ts +12 -4
- package/dest/interfaces/get_logs_response.d.ts.map +1 -1
- package/dest/interfaces/get_logs_response.js +5 -4
- package/dest/interfaces/prover-client.d.ts +5 -3
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +5 -4
- package/dest/interfaces/slasher.d.ts +1 -1
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +3 -3
- package/dest/interfaces/validator.d.ts +7 -8
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +5 -5
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +1 -3
- package/dest/schemas/schemas.d.ts +2 -2
- package/dest/schemas/schemas.d.ts.map +1 -1
- package/dest/schemas/schemas.js +1 -1
- package/dest/slashing/types.d.ts +4 -5
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +5 -5
- package/dest/snapshots/types.d.ts +1 -1
- package/dest/snapshots/types.d.ts.map +1 -1
- package/dest/snapshots/types.js +5 -5
- package/dest/tests/mocks.d.ts +5 -4
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +18 -5
- package/dest/tx/private_execution_result.d.ts +1 -1
- package/dest/tx/private_execution_result.js +1 -1
- package/dest/tx/simulated_tx.d.ts +1031 -7
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/validator/tx_validator.d.ts +1 -4
- package/dest/tx/validator/tx_validator.d.ts.map +1 -1
- package/dest/tx/validator/tx_validator.js +4 -4
- package/dest/validators/schemas.d.ts +1 -1
- package/dest/validators/schemas.d.ts.map +1 -1
- package/dest/validators/schemas.js +13 -13
- package/package.json +8 -8
- package/src/abi/abi.ts +39 -33
- package/src/abi/function_selector.ts +8 -0
- package/src/avm/avm.ts +1 -1
- package/src/block/{published_l2_block.ts → checkpointed_l2_block.ts} +58 -3
- package/src/block/index.ts +1 -1
- package/src/block/l2_block_source.ts +70 -50
- package/src/block/l2_block_stream/interfaces.ts +1 -1
- package/src/block/l2_block_stream/l2_block_stream.ts +9 -0
- package/src/block/test/l2_tips_store_test_suite.ts +2 -1
- package/src/checkpoint/checkpoint.ts +19 -4
- package/src/checkpoint/published_checkpoint.ts +19 -5
- package/src/contract/interfaces/contract_class.ts +59 -46
- package/src/contract/interfaces/contract_instance.ts +15 -13
- package/src/contract/interfaces/contract_instance_update.ts +11 -9
- package/src/epoch-helpers/index.ts +11 -9
- package/src/interfaces/allowed_element.ts +9 -7
- package/src/interfaces/archiver.ts +2 -2
- package/src/interfaces/aztec-node.ts +1 -1
- package/src/interfaces/configs.ts +30 -27
- package/src/interfaces/get_logs_response.ts +13 -9
- package/src/interfaces/prover-client.ts +13 -10
- package/src/interfaces/slasher.ts +24 -22
- package/src/interfaces/validator.ts +22 -18
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +2 -4
- package/src/schemas/schemas.ts +1 -0
- package/src/slashing/types.ts +24 -20
- package/src/snapshots/types.ts +33 -29
- package/src/tests/mocks.ts +15 -3
- package/src/tx/private_execution_result.ts +1 -1
- package/src/tx/validator/tx_validator.ts +8 -6
- package/src/validators/schemas.ts +54 -48
- package/dest/block/published_l2_block.d.ts +0 -130
- package/dest/block/published_l2_block.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulated_tx.d.ts","sourceRoot":"","sources":["../../src/tx/simulated_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,eAAe,CAAC;AAC9E,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oCAAoC,EAAE,MAAM,wDAAwD,CAAC;AAE9G,OAAO,EAEL,sBAAsB,EAEvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAO7B,MAAM,MAAM,iBAAiB,GAAG,MAAM,CACpC,MAAM,EACN;IAAE,QAAQ,EAAE,2BAA2B,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,CAC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;;;;;;;;;;OAahB;CACF;AAED,qBAAa,uBAAuB;IAEzB,sBAAsB,EAAE,sBAAsB;IAC9C,YAAY,EAAE,oCAAoC;IAF3D,YACS,sBAAsB,EAAE,sBAAsB,EAC9C,YAAY,EAAE,oCAAoC,EACvD;IAEJ,sBAAsB,8BAErB;IAEK,aAAa,IAAI,OAAO,CAAC,EAAE,CAAC,CASjC;CACF;AAED,qBAAa,kBAAkB;IAEpB,sBAAsB,EAAE,sBAAsB;IAC9C,YAAY,EAAE,oCAAoC;IAClD,YAAY,CAAC;IACb,KAAK,CAAC;IAJf,YACS,sBAAsB,EAAE,sBAAsB,EAC9C,YAAY,EAAE,oCAAoC,EAClD,YAAY,CAAC,oCAAwB,EACrC,KAAK,CAAC,6BAAiB,EAC5B;IAEJ,IAAI,OAAO,IAAI,OAAO,CASrB;IAED,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAS9C;IAED,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,CAAC,sBAOhE;IAED,MAAM,CAAC,0CAA0C,CAC/C,uBAAuB,EAAE,uBAAuB,EAChD,YAAY,CAAC,EAAE,sBAAsB,EACrC,KAAK,CAAC,EAAE,eAAe,sBAQxB;IAED,OAAa,MAAM,gCAMlB;IAED,sBAAsB,8BAErB;IAED,aAAa,IAAI,OAAO,CAAC,EAAE,CAAC,CAE3B;IAED,qBAAqB,gCAEpB;CACF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,sBAAsB,GAAG,yBAAyB,CAWhH"}
|
|
@@ -19,13 +19,10 @@ export interface TxValidator<T extends AnyTx = AnyTx> {
|
|
|
19
19
|
}
|
|
20
20
|
export declare const TxValidationResultSchema: z.ZodDiscriminatedUnion<"result", [z.ZodObject<{
|
|
21
21
|
result: z.ZodLiteral<"valid">;
|
|
22
|
-
reason: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
23
22
|
}, "strip", z.ZodTypeAny, {
|
|
24
23
|
result: "valid";
|
|
25
|
-
reason?: string[] | undefined;
|
|
26
24
|
}, {
|
|
27
25
|
result: "valid";
|
|
28
|
-
reason?: string[] | undefined;
|
|
29
26
|
}>, z.ZodObject<{
|
|
30
27
|
result: z.ZodLiteral<"invalid">;
|
|
31
28
|
reason: z.ZodArray<z.ZodString, "many">;
|
|
@@ -45,4 +42,4 @@ export declare const TxValidationResultSchema: z.ZodDiscriminatedUnion<"result",
|
|
|
45
42
|
result: "skipped";
|
|
46
43
|
reason: string[];
|
|
47
44
|
}>]>;
|
|
48
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfdmFsaWRhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHgvdmFsaWRhdG9yL3R4X3ZhbGlkYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBR3hCLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFNUMsTUFBTSxNQUFNLEtBQUssR0FBRyxFQUFFLEdBQUcsV0FBVyxDQUFDO0FBRXJDLHdCQUFnQixTQUFTLENBQUMsRUFBRSxFQUFFLEtBQUssR0FBRyxNQUFNLENBRTNDO0FBRUQsd0JBQWdCLGNBQWMsQ0FBQyxFQUFFLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FFakQ7QUFFRCxNQUFNLE1BQU0sa0JBQ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from 'zod';
|
|
2
|
+
import { zodFor } from '../../schemas/schemas.js';
|
|
2
3
|
export function getTxHash(tx) {
|
|
3
4
|
return 'txHash' in tx ? tx.txHash : tx.hash;
|
|
4
5
|
}
|
|
5
6
|
export function hasPublicCalls(tx) {
|
|
6
7
|
return tx.data.numberOfPublicCallRequests() > 0;
|
|
7
8
|
}
|
|
8
|
-
export const TxValidationResultSchema = z.discriminatedUnion('result', [
|
|
9
|
+
export const TxValidationResultSchema = zodFor()(z.discriminatedUnion('result', [
|
|
9
10
|
z.object({
|
|
10
|
-
result: z.literal('valid')
|
|
11
|
-
reason: z.array(z.string()).optional()
|
|
11
|
+
result: z.literal('valid')
|
|
12
12
|
}),
|
|
13
13
|
z.object({
|
|
14
14
|
result: z.literal('invalid'),
|
|
@@ -18,4 +18,4 @@ export const TxValidationResultSchema = z.discriminatedUnion('result', [
|
|
|
18
18
|
result: z.literal('skipped'),
|
|
19
19
|
reason: z.array(z.string())
|
|
20
20
|
})
|
|
21
|
-
]);
|
|
21
|
+
]));
|
|
@@ -647,4 +647,4 @@ export declare const SingleValidatorStatsSchema: z.ZodObject<{
|
|
|
647
647
|
initialSlot?: string | number | bigint | undefined;
|
|
648
648
|
slotWindow: string | number | bigint;
|
|
649
649
|
}>;
|
|
650
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
650
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NoZW1hcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ZhbGlkYXRvcnMvc2NoZW1hcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBV3hCLGVBQU8sTUFBTSwyQkFBMkIsd0dBRXZDLENBQUM7QUFFRixlQUFPLE1BQU0sNEJBQTRCOzs7Ozs7Ozs7OztXQU94QyxDQUFDO0F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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EActC,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { schemas } from '@aztec/foundation/schemas';
|
|
1
|
+
import { schemas, zodFor } from '@aztec/foundation/schemas';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
export const ValidatorStatusInSlotSchema = z.enum([
|
|
3
|
+
export const ValidatorStatusInSlotSchema = zodFor()(z.enum([
|
|
4
4
|
'block-mined',
|
|
5
5
|
'block-proposed',
|
|
6
6
|
'block-missed',
|
|
7
7
|
'attestation-sent',
|
|
8
8
|
'attestation-missed'
|
|
9
|
-
]);
|
|
10
|
-
export const ValidatorStatusHistorySchema = z.array(z.object({
|
|
9
|
+
]));
|
|
10
|
+
export const ValidatorStatusHistorySchema = zodFor()(z.array(z.object({
|
|
11
11
|
slot: schemas.SlotNumber,
|
|
12
12
|
status: ValidatorStatusInSlotSchema
|
|
13
|
-
}));
|
|
13
|
+
})));
|
|
14
14
|
export const ValidatorStatusHistorySchemaArray = z.array(ValidatorStatusHistorySchema);
|
|
15
15
|
export const ValidatorStatusHistorySchemaMap = z.record(ValidatorStatusHistorySchemaArray);
|
|
16
16
|
const ValidatorTimeStatSchema = z.object({
|
|
@@ -18,13 +18,13 @@ const ValidatorTimeStatSchema = z.object({
|
|
|
18
18
|
slot: schemas.SlotNumber,
|
|
19
19
|
date: z.string()
|
|
20
20
|
});
|
|
21
|
-
const ValidatorMissedStatsSchema = z.object({
|
|
21
|
+
const ValidatorMissedStatsSchema = zodFor()(z.object({
|
|
22
22
|
currentStreak: schemas.Integer,
|
|
23
23
|
rate: z.number().optional(),
|
|
24
24
|
count: schemas.Integer,
|
|
25
25
|
total: schemas.Integer
|
|
26
|
-
});
|
|
27
|
-
export const ValidatorStatsSchema = z.object({
|
|
26
|
+
}));
|
|
27
|
+
export const ValidatorStatsSchema = zodFor()(z.object({
|
|
28
28
|
address: schemas.EthAddress,
|
|
29
29
|
lastProposal: ValidatorTimeStatSchema.optional(),
|
|
30
30
|
lastAttestation: ValidatorTimeStatSchema.optional(),
|
|
@@ -32,14 +32,14 @@ export const ValidatorStatsSchema = z.object({
|
|
|
32
32
|
missedProposals: ValidatorMissedStatsSchema,
|
|
33
33
|
missedAttestations: ValidatorMissedStatsSchema,
|
|
34
34
|
history: ValidatorStatusHistorySchema
|
|
35
|
-
});
|
|
36
|
-
export const ValidatorsStatsSchema = z.object({
|
|
35
|
+
}));
|
|
36
|
+
export const ValidatorsStatsSchema = zodFor()(z.object({
|
|
37
37
|
stats: z.record(ValidatorStatsSchema),
|
|
38
38
|
lastProcessedSlot: schemas.SlotNumber.optional(),
|
|
39
39
|
initialSlot: schemas.SlotNumber.optional(),
|
|
40
40
|
slotWindow: schemas.Integer
|
|
41
|
-
});
|
|
42
|
-
export const SingleValidatorStatsSchema = z.object({
|
|
41
|
+
}));
|
|
42
|
+
export const SingleValidatorStatsSchema = zodFor()(z.object({
|
|
43
43
|
validator: ValidatorStatsSchema,
|
|
44
44
|
allTimeProvenPerformance: z.array(z.object({
|
|
45
45
|
missed: schemas.Integer,
|
|
@@ -49,4 +49,4 @@ export const SingleValidatorStatsSchema = z.object({
|
|
|
49
49
|
lastProcessedSlot: schemas.SlotNumber.optional(),
|
|
50
50
|
initialSlot: schemas.SlotNumber.optional(),
|
|
51
51
|
slotWindow: schemas.Integer
|
|
52
|
-
});
|
|
52
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251217",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
80
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
81
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
82
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
83
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
84
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
85
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
86
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
80
|
+
"@aztec/bb.js": "3.0.0-nightly.20251217",
|
|
81
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251217",
|
|
82
|
+
"@aztec/constants": "3.0.0-nightly.20251217",
|
|
83
|
+
"@aztec/ethereum": "3.0.0-nightly.20251217",
|
|
84
|
+
"@aztec/foundation": "3.0.0-nightly.20251217",
|
|
85
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251217",
|
|
86
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251217",
|
|
87
87
|
"@google-cloud/storage": "^7.15.0",
|
|
88
88
|
"axios": "^1.12.0",
|
|
89
89
|
"json-stringify-deterministic": "1.0.12",
|
package/src/abi/abi.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import {
|
|
4
|
+
import { schemas, zodFor } from '@aztec/foundation/schemas';
|
|
5
5
|
|
|
6
6
|
import { inflate } from 'pako';
|
|
7
7
|
import { z } from 'zod';
|
|
@@ -154,11 +154,13 @@ export type AbiErrorType =
|
|
|
154
154
|
| { error_kind: 'fmtstring'; length: number; item_types: AbiType[] }
|
|
155
155
|
| ({ error_kind: 'custom' } & AbiType);
|
|
156
156
|
|
|
157
|
-
const AbiErrorTypeSchema =
|
|
158
|
-
z.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
157
|
+
const AbiErrorTypeSchema = zodFor<AbiErrorType>()(
|
|
158
|
+
z.union([
|
|
159
|
+
z.object({ error_kind: z.literal('string'), string: z.string() }),
|
|
160
|
+
z.object({ error_kind: z.literal('fmtstring'), length: z.number(), item_types: z.array(AbiTypeSchema) }),
|
|
161
|
+
z.object({ error_kind: z.literal('custom') }).and(AbiTypeSchema),
|
|
162
|
+
]),
|
|
163
|
+
);
|
|
162
164
|
|
|
163
165
|
/** Aztec.nr function types. */
|
|
164
166
|
export enum FunctionType {
|
|
@@ -242,14 +244,16 @@ export interface FunctionArtifactWithContractName extends FunctionArtifact {
|
|
|
242
244
|
contractName: string;
|
|
243
245
|
}
|
|
244
246
|
|
|
245
|
-
export const FunctionArtifactSchema =
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
)
|
|
247
|
+
export const FunctionArtifactSchema = zodFor<FunctionArtifact>()(
|
|
248
|
+
FunctionAbiSchema.and(
|
|
249
|
+
z.object({
|
|
250
|
+
bytecode: schemas.Buffer,
|
|
251
|
+
verificationKey: z.string().optional(),
|
|
252
|
+
debugSymbols: z.string(),
|
|
253
|
+
debug: FunctionDebugMetadataSchema.optional(),
|
|
254
|
+
}),
|
|
255
|
+
),
|
|
256
|
+
);
|
|
253
257
|
|
|
254
258
|
/** A file ID. It's assigned during compilation. */
|
|
255
259
|
type FileId = number;
|
|
@@ -342,28 +346,30 @@ export interface ContractArtifact {
|
|
|
342
346
|
fileMap: DebugFileMap;
|
|
343
347
|
}
|
|
344
348
|
|
|
345
|
-
export const ContractArtifactSchema
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
349
|
+
export const ContractArtifactSchema = zodFor<ContractArtifact>()(
|
|
350
|
+
z.object({
|
|
351
|
+
name: z.string(),
|
|
352
|
+
functions: z.array(FunctionArtifactSchema),
|
|
353
|
+
nonDispatchPublicFunctions: z.array(FunctionAbiSchema),
|
|
354
|
+
outputs: z.object({
|
|
355
|
+
structs: z.record(z.array(AbiTypeSchema)).transform(structs => {
|
|
356
|
+
for (const [key, value] of Object.entries(structs)) {
|
|
357
|
+
// We are manually ordering events and functions in the abi by path.
|
|
358
|
+
// The path ordering is arbitrary, and only needed to ensure deterministic order.
|
|
359
|
+
// These are the only arrays in the artifact with arbitrary order, and hence the only ones
|
|
360
|
+
// we need to sort.
|
|
361
|
+
if (key === 'events' || key === 'functions') {
|
|
362
|
+
structs[key] = (value as StructType[]).sort((a, b) => (a.path > b.path ? -1 : 1));
|
|
363
|
+
}
|
|
358
364
|
}
|
|
359
|
-
|
|
360
|
-
|
|
365
|
+
return structs;
|
|
366
|
+
}),
|
|
367
|
+
globals: z.record(z.array(AbiValueSchema)),
|
|
361
368
|
}),
|
|
362
|
-
|
|
369
|
+
storageLayout: z.record(z.object({ slot: schemas.Fr })),
|
|
370
|
+
fileMap: z.record(z.coerce.number(), z.object({ source: z.string(), path: z.string() })),
|
|
363
371
|
}),
|
|
364
|
-
|
|
365
|
-
fileMap: z.record(z.coerce.number(), z.object({ source: z.string(), path: z.string() })),
|
|
366
|
-
});
|
|
372
|
+
);
|
|
367
373
|
|
|
368
374
|
export function getFunctionArtifactByName(artifact: ContractArtifact, functionName: string): FunctionArtifact {
|
|
369
375
|
const functionArtifact = artifact.functions.find(f => f.name === functionName);
|
|
@@ -39,6 +39,14 @@ export class FunctionSelector extends Selector {
|
|
|
39
39
|
return new FunctionSelector(Number(fr.toBigInt()));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
static fromFieldOrUndefined(fr: Fr) {
|
|
43
|
+
try {
|
|
44
|
+
return FunctionSelector.fromField(fr);
|
|
45
|
+
} catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
42
50
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
43
51
|
const reader = FieldReader.asReader(fields);
|
|
44
52
|
return FunctionSelector.fromField(reader.readField());
|
package/src/avm/avm.ts
CHANGED
|
@@ -1148,7 +1148,7 @@ export class CallStackMetadata {
|
|
|
1148
1148
|
const { stack, leaf } = failingCall;
|
|
1149
1149
|
const aztecCallStack = stack.map(call => ({
|
|
1150
1150
|
contractAddress: AztecAddress.fromField(call.contractAddress),
|
|
1151
|
-
functionSelector: call.calldata.length > 0 ? FunctionSelector.
|
|
1151
|
+
functionSelector: call.calldata.length > 0 ? FunctionSelector.fromFieldOrUndefined(call.calldata[0]) : undefined,
|
|
1152
1152
|
}));
|
|
1153
1153
|
|
|
1154
1154
|
// The Noir call stack is the internal call stack at exit of the failing call
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Ignoring import issue to fix portable inferred type issue in zod schema
|
|
2
|
+
import { CheckpointNumber, CheckpointNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
4
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
4
5
|
|
|
@@ -6,13 +7,67 @@ import { z } from 'zod';
|
|
|
6
7
|
|
|
7
8
|
import { L1PublishedData, PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
8
9
|
import { L2Block } from './l2_block.js';
|
|
10
|
+
import { L2BlockNew } from './l2_block_new.js';
|
|
9
11
|
import { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
13
|
-
* L2 blocks do not need to link to L1PublishedData directly.
|
|
14
|
-
* TODO: Create another type (AttestedL2Block?) for an L2 block and its attestations.
|
|
14
|
+
* Encapsulates an L2 Block along with the checkpoint data associated with it.
|
|
15
15
|
*/
|
|
16
|
+
export class CheckpointedL2Block {
|
|
17
|
+
constructor(
|
|
18
|
+
public checkpointNumber: CheckpointNumber,
|
|
19
|
+
public block: L2BlockNew,
|
|
20
|
+
public l1: L1PublishedData,
|
|
21
|
+
public attestations: CommitteeAttestation[],
|
|
22
|
+
) {}
|
|
23
|
+
static get schema() {
|
|
24
|
+
return z
|
|
25
|
+
.object({
|
|
26
|
+
checkpointNumber: CheckpointNumberSchema,
|
|
27
|
+
block: L2BlockNew.schema,
|
|
28
|
+
l1: L1PublishedData.schema,
|
|
29
|
+
attestations: z.array(CommitteeAttestation.schema),
|
|
30
|
+
})
|
|
31
|
+
.transform(obj => CheckpointedL2Block.fromFields(obj));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static fromBuffer(bufferOrReader: Buffer | BufferReader): CheckpointedL2Block {
|
|
35
|
+
const reader = BufferReader.asReader(bufferOrReader);
|
|
36
|
+
const checkpointNumber = reader.readNumber();
|
|
37
|
+
const block = reader.readObject(L2BlockNew);
|
|
38
|
+
const l1BlockNumber = reader.readBigInt();
|
|
39
|
+
const l1BlockHash = reader.readString();
|
|
40
|
+
const l1Timestamp = reader.readBigInt();
|
|
41
|
+
const attestations = reader.readVector(CommitteeAttestation);
|
|
42
|
+
return new CheckpointedL2Block(
|
|
43
|
+
CheckpointNumber(checkpointNumber),
|
|
44
|
+
block,
|
|
45
|
+
new L1PublishedData(l1BlockNumber, l1Timestamp, l1BlockHash),
|
|
46
|
+
attestations,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static fromFields(fields: FieldsOf<CheckpointedL2Block>) {
|
|
51
|
+
return new CheckpointedL2Block(
|
|
52
|
+
CheckpointNumber(fields.checkpointNumber),
|
|
53
|
+
fields.block,
|
|
54
|
+
fields.l1,
|
|
55
|
+
fields.attestations,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public toBuffer(): Buffer {
|
|
60
|
+
return serializeToBuffer(
|
|
61
|
+
this.block,
|
|
62
|
+
this.l1.blockNumber,
|
|
63
|
+
this.l1.blockHash,
|
|
64
|
+
this.l1.timestamp,
|
|
65
|
+
this.attestations.length,
|
|
66
|
+
this.attestations,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
16
71
|
export class PublishedL2Block {
|
|
17
72
|
constructor(
|
|
18
73
|
public block: L2Block,
|
package/src/block/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from './body.js';
|
|
|
7
7
|
export * from './block_parameter.js';
|
|
8
8
|
export * from './l2_block_source.js';
|
|
9
9
|
export * from './block_hash.js';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './checkpointed_l2_block.js';
|
|
11
11
|
export * from './proposal/index.js';
|
|
12
12
|
export * from './validate_block_result.js';
|
|
13
13
|
export * from './l2_block_info.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlockNumber,
|
|
3
3
|
BlockNumberSchema,
|
|
4
|
-
|
|
4
|
+
CheckpointNumber,
|
|
5
5
|
type EpochNumber,
|
|
6
6
|
type SlotNumber,
|
|
7
7
|
} from '@aztec/foundation/branded-types';
|
|
@@ -18,8 +18,9 @@ import type { BlockHeader } from '../tx/block_header.js';
|
|
|
18
18
|
import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
|
|
19
19
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
20
20
|
import type { TxReceipt } from '../tx/tx_receipt.js';
|
|
21
|
+
import { type CheckpointedL2Block, PublishedL2Block } from './checkpointed_l2_block.js';
|
|
21
22
|
import type { L2Block } from './l2_block.js';
|
|
22
|
-
import {
|
|
23
|
+
import type { L2BlockNew } from './l2_block_new.js';
|
|
23
24
|
import type { ValidateBlockNegativeResult, ValidateBlockResult } from './validate_block_result.js';
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -50,13 +51,6 @@ export interface L2BlockSource {
|
|
|
50
51
|
*/
|
|
51
52
|
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
52
53
|
|
|
53
|
-
/**
|
|
54
|
-
* Gets an l2 block. If a negative number is passed, the block returned is the most recent.
|
|
55
|
-
* @param number - The block number to return (inclusive).
|
|
56
|
-
* @returns The requested L2 block.
|
|
57
|
-
*/
|
|
58
|
-
getBlock(number: BlockNumber): Promise<L2Block | undefined>;
|
|
59
|
-
|
|
60
54
|
/**
|
|
61
55
|
* Gets an l2 block header.
|
|
62
56
|
* @param number - The block number to return or 'latest' for the most recent one.
|
|
@@ -65,40 +59,26 @@ export interface L2BlockSource {
|
|
|
65
59
|
getBlockHeader(number: BlockNumber | 'latest'): Promise<BlockHeader | undefined>;
|
|
66
60
|
|
|
67
61
|
/**
|
|
68
|
-
* Gets
|
|
69
|
-
*
|
|
70
|
-
* @param
|
|
71
|
-
* @
|
|
72
|
-
* @returns The requested L2 blocks.
|
|
62
|
+
* Gets a checkpointed L2 block by block number.
|
|
63
|
+
* Returns undefined if the block doesn't exist or hasn't been checkpointed yet.
|
|
64
|
+
* @param number - The block number to retrieve.
|
|
65
|
+
* @returns The requested checkpointed L2 block (or undefined if not found or not checkpointed).
|
|
73
66
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
getPublishedCheckpoints(from: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
|
|
67
|
+
getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined>;
|
|
77
68
|
|
|
78
69
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @param
|
|
82
|
-
* @returns The
|
|
70
|
+
* Retrieves a collection of published checkpoints
|
|
71
|
+
* @param checkpointNumber The first checkpoint to be retrieved
|
|
72
|
+
* @param limit The number of checkpoints to be retrieved
|
|
73
|
+
* @returns The collection of complete checkpoints
|
|
83
74
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/** Equivalent to getBlocks but includes publish data. */
|
|
87
|
-
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<PublishedL2Block[]>;
|
|
75
|
+
getPublishedCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
|
|
88
76
|
|
|
89
77
|
/**
|
|
90
|
-
* Gets
|
|
91
|
-
* @param
|
|
92
|
-
* @returns The requested published block (or undefined if not found).
|
|
78
|
+
* Gets the checkpoints for a given epoch
|
|
79
|
+
* @param epochNumber - Epoch for which we want checkpoint data
|
|
93
80
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Gets a published block by its archive root.
|
|
98
|
-
* @param archive - The archive root to retrieve.
|
|
99
|
-
* @returns The requested published block (or undefined if not found).
|
|
100
|
-
*/
|
|
101
|
-
getPublishedBlockByArchive(archive: Fr): Promise<PublishedL2Block | undefined>;
|
|
81
|
+
getCheckpointsForEpoch(epochNumber: EpochNumber): Promise<Checkpoint[]>;
|
|
102
82
|
|
|
103
83
|
/**
|
|
104
84
|
* Gets a block header by its hash.
|
|
@@ -138,20 +118,6 @@ export interface L2BlockSource {
|
|
|
138
118
|
*/
|
|
139
119
|
getL2EpochNumber(): Promise<EpochNumber | undefined>;
|
|
140
120
|
|
|
141
|
-
/**
|
|
142
|
-
* Returns all checkpoints for a given epoch.
|
|
143
|
-
* @dev Use this method only with recent epochs, since it walks the checkpoint list backwards.
|
|
144
|
-
* @param epochNumber - The epoch number to return checkpoints for.
|
|
145
|
-
*/
|
|
146
|
-
getCheckpointsForEpoch(epochNumber: EpochNumber): Promise<Checkpoint[]>;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Returns all blocks for a given epoch.
|
|
150
|
-
* @dev Use this method only with recent epochs, since it walks the block list backwards.
|
|
151
|
-
* @param epochNumber - The epoch number to return blocks for.
|
|
152
|
-
*/
|
|
153
|
-
getBlocksForEpoch(epochNumber: EpochNumber): Promise<L2Block[]>;
|
|
154
|
-
|
|
155
121
|
/**
|
|
156
122
|
* Returns all block headers for a given epoch.
|
|
157
123
|
* @dev Use this method only with recent epochs, since it walks the block list backwards.
|
|
@@ -195,6 +161,60 @@ export interface L2BlockSource {
|
|
|
195
161
|
|
|
196
162
|
/** Force a sync. */
|
|
197
163
|
syncImmediate(): Promise<void>;
|
|
164
|
+
|
|
165
|
+
/* Legacy APIS */
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Gets an l2 block. If a negative number is passed, the block returned is the most recent.
|
|
169
|
+
* @param number - The block number to return (inclusive).
|
|
170
|
+
* @returns The requested L2 block.
|
|
171
|
+
*/
|
|
172
|
+
getBlock(number: BlockNumber): Promise<L2Block | undefined>;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Returns all blocks for a given epoch.
|
|
176
|
+
* @dev Use this method only with recent epochs, since it walks the block list backwards.
|
|
177
|
+
* @param epochNumber - The epoch number to return blocks for.
|
|
178
|
+
*/
|
|
179
|
+
getBlocksForEpoch(epochNumber: EpochNumber): Promise<L2Block[]>;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Gets a published block by its block hash.
|
|
183
|
+
* @param blockHash - The block hash to retrieve.
|
|
184
|
+
* @returns The requested block (or undefined if not found).
|
|
185
|
+
*/
|
|
186
|
+
getPublishedBlockByHash(blockHash: Fr): Promise<PublishedL2Block | undefined>;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Gets a published block by its archive root.
|
|
190
|
+
* @param archive - The archive root to retrieve.
|
|
191
|
+
* @returns The requested block (or undefined if not found).
|
|
192
|
+
*/
|
|
193
|
+
getPublishedBlockByArchive(archive: Fr): Promise<PublishedL2Block | undefined>;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
197
|
+
* @param from - Number of the first block to return (inclusive).
|
|
198
|
+
* @param limit - The maximum number of blocks to return.
|
|
199
|
+
* @param proven - If true, only return blocks that have been proven.
|
|
200
|
+
* @returns The requested L2 blocks.
|
|
201
|
+
*/
|
|
202
|
+
getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2Block[]>;
|
|
203
|
+
|
|
204
|
+
/** Equivalent to getBlocks but includes publish data. */
|
|
205
|
+
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<PublishedL2Block[]>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Interface for classes that can receive and store L2 blocks.
|
|
210
|
+
*/
|
|
211
|
+
export interface L2BlockSink {
|
|
212
|
+
/**
|
|
213
|
+
* Adds a block to the store.
|
|
214
|
+
* @param block - The L2 block to add.
|
|
215
|
+
* @throws If block number is not incremental (i.e., not exactly one more than the last stored block).
|
|
216
|
+
*/
|
|
217
|
+
addBlock(block: L2BlockNew): Promise<void>;
|
|
198
218
|
}
|
|
199
219
|
|
|
200
220
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { PublishedL2Block } from '../checkpointed_l2_block.js';
|
|
1
2
|
import type { L2BlockId, L2Tips } from '../l2_block_source.js';
|
|
2
|
-
import type { PublishedL2Block } from '../published_l2_block.js';
|
|
3
3
|
|
|
4
4
|
/** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
|
|
5
5
|
export interface L2BlockStreamLocalDataProvider {
|
|
@@ -26,6 +26,10 @@ export class L2BlockStream {
|
|
|
26
26
|
skipFinalized?: boolean;
|
|
27
27
|
} = {},
|
|
28
28
|
) {
|
|
29
|
+
// Note that RunningPromise is in stopped state by default. This promise won't run until someone invokes `start`,
|
|
30
|
+
// which makes it run periodically, or `sync`, which triggers it once.
|
|
31
|
+
// Users of L2BlockStream decide what mode to run it in (_periodically_ vs _manually triggered_).
|
|
32
|
+
// The default is _manually triggered_.
|
|
29
33
|
this.runningPromise = new RunningPromise(() => this.work(), log, this.opts.pollIntervalMS ?? 1000);
|
|
30
34
|
}
|
|
31
35
|
|
|
@@ -42,6 +46,11 @@ export class L2BlockStream {
|
|
|
42
46
|
return this.runningPromise.isRunning();
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Runs the synchronization process once.
|
|
51
|
+
*
|
|
52
|
+
* If you want to run this process continuously use `start` and `stop` instead.
|
|
53
|
+
*/
|
|
45
54
|
public async sync() {
|
|
46
55
|
this.isSyncing = true;
|
|
47
56
|
await this.runningPromise.trigger();
|
|
@@ -3,6 +3,7 @@ import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
|
3
3
|
import { times } from '@aztec/foundation/collection';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { type L2Block, type L2BlockId, PublishedL2Block } from '@aztec/stdlib/block';
|
|
6
|
+
import { L1PublishedData } from '@aztec/stdlib/checkpoint';
|
|
6
7
|
|
|
7
8
|
import { jestExpect as expect } from '@jest/expect';
|
|
8
9
|
|
|
@@ -18,7 +19,7 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
18
19
|
const makeBlock = (number: number): PublishedL2Block =>
|
|
19
20
|
PublishedL2Block.fromFields({
|
|
20
21
|
block: { number: BlockNumber(number), hash: () => Promise.resolve(new Fr(number)) } as L2Block,
|
|
21
|
-
l1:
|
|
22
|
+
l1: new L1PublishedData(BigInt(number), BigInt(number), `0x${number}`),
|
|
22
23
|
attestations: [],
|
|
23
24
|
});
|
|
24
25
|
|