@aztec/stdlib 3.0.0-nightly.20251214 → 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 +19 -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/logs/extended_public_log.d.ts +7 -1
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +9 -1
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +15 -8
- package/dest/logs/tx_scoped_l2_log.d.ts +8 -2
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +13 -6
- 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/logs/log_id.ts +16 -6
- package/src/logs/tx_scoped_l2_log.ts +14 -6
- 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
|
@@ -73,15 +73,30 @@ export class Checkpoint {
|
|
|
73
73
|
{
|
|
74
74
|
numBlocks = 1,
|
|
75
75
|
startBlockNumber = 1,
|
|
76
|
+
previousArchive,
|
|
76
77
|
...options
|
|
77
|
-
}: {
|
|
78
|
+
}: {
|
|
79
|
+
numBlocks?: number;
|
|
80
|
+
startBlockNumber?: number;
|
|
81
|
+
previousArchive?: AppendOnlyTreeSnapshot;
|
|
82
|
+
} & Partial<Parameters<typeof CheckpointHeader.random>[0]> &
|
|
78
83
|
Partial<Parameters<typeof L2BlockNew.random>[1]> = {},
|
|
79
84
|
) {
|
|
80
85
|
const header = CheckpointHeader.random(options);
|
|
81
86
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
// Create blocks sequentially to chain archive roots properly.
|
|
88
|
+
// Each block's header.lastArchive must equal the previous block's archive.
|
|
89
|
+
const blocks: L2BlockNew[] = [];
|
|
90
|
+
let lastArchive = previousArchive;
|
|
91
|
+
for (let i = 0; i < numBlocks; i++) {
|
|
92
|
+
const block = await L2BlockNew.random(BlockNumber(startBlockNumber + i), {
|
|
93
|
+
indexWithinCheckpoint: i,
|
|
94
|
+
...options,
|
|
95
|
+
...(lastArchive ? { lastArchive } : {}),
|
|
96
|
+
});
|
|
97
|
+
lastArchive = block.archive;
|
|
98
|
+
blocks.push(block);
|
|
99
|
+
}
|
|
85
100
|
|
|
86
101
|
return new Checkpoint(AppendOnlyTreeSnapshot.random(), header, blocks, checkpointNumber);
|
|
87
102
|
}
|
|
@@ -18,11 +18,13 @@ export class L1PublishedData {
|
|
|
18
18
|
) {}
|
|
19
19
|
|
|
20
20
|
static get schema() {
|
|
21
|
-
return z
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
return z
|
|
22
|
+
.object({
|
|
23
|
+
blockNumber: schemas.BigInt,
|
|
24
|
+
timestamp: schemas.BigInt,
|
|
25
|
+
blockHash: z.string(),
|
|
26
|
+
})
|
|
27
|
+
.transform(obj => L1PublishedData.fromFields(obj));
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
static random() {
|
|
@@ -36,6 +38,18 @@ export class L1PublishedData {
|
|
|
36
38
|
static fromFields(fields: FieldsOf<L1PublishedData>) {
|
|
37
39
|
return new L1PublishedData(fields.blockNumber, fields.timestamp, fields.blockHash);
|
|
38
40
|
}
|
|
41
|
+
|
|
42
|
+
static fromBuffer(bufferOrReader: Buffer | BufferReader): L1PublishedData {
|
|
43
|
+
const reader = BufferReader.asReader(bufferOrReader);
|
|
44
|
+
const l1BlockNumber = reader.readBigInt();
|
|
45
|
+
const l1BlockHash = reader.readString();
|
|
46
|
+
const l1Timestamp = reader.readBigInt();
|
|
47
|
+
return new L1PublishedData(l1BlockNumber, l1Timestamp, l1BlockHash);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public toBuffer(): Buffer {
|
|
51
|
+
return serializeToBuffer(this.blockNumber, this.blockHash, this.timestamp);
|
|
52
|
+
}
|
|
39
53
|
}
|
|
40
54
|
|
|
41
55
|
export class PublishedCheckpoint {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import {
|
|
2
|
+
import { schemas, zodFor } from '@aztec/foundation/schemas';
|
|
3
3
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
@@ -35,10 +35,12 @@ export interface PrivateFunction {
|
|
|
35
35
|
vkHash: Fr;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const PrivateFunctionSchema =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
const PrivateFunctionSchema = zodFor<PrivateFunction>()(
|
|
39
|
+
z.object({
|
|
40
|
+
selector: FunctionSelector.schema,
|
|
41
|
+
vkHash: schemas.Fr,
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
42
44
|
|
|
43
45
|
/** Private function definition with executable bytecode. */
|
|
44
46
|
export interface ExecutablePrivateFunction extends PrivateFunction {
|
|
@@ -46,9 +48,9 @@ export interface ExecutablePrivateFunction extends PrivateFunction {
|
|
|
46
48
|
bytecode: Buffer;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
const ExecutablePrivateFunctionSchema =
|
|
50
|
-
z.object({ bytecode: schemas.Buffer }),
|
|
51
|
-
)
|
|
51
|
+
const ExecutablePrivateFunctionSchema = zodFor<ExecutablePrivateFunction>()(
|
|
52
|
+
PrivateFunctionSchema.and(z.object({ bytecode: schemas.Buffer })),
|
|
53
|
+
);
|
|
52
54
|
|
|
53
55
|
/** Utility function definition. */
|
|
54
56
|
export interface UtilityFunction {
|
|
@@ -58,11 +60,12 @@ export interface UtilityFunction {
|
|
|
58
60
|
bytecode: Buffer;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
const UtilityFunctionSchema =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
})
|
|
63
|
+
const UtilityFunctionSchema = zodFor<UtilityFunction>()(
|
|
64
|
+
z.object({
|
|
65
|
+
selector: FunctionSelector.schema,
|
|
66
|
+
bytecode: schemas.Buffer,
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
66
69
|
|
|
67
70
|
/** Sibling paths and sibling commitments for proving membership of a private function within a contract class. */
|
|
68
71
|
export type PrivateFunctionMembershipProof = {
|
|
@@ -75,15 +78,17 @@ export type PrivateFunctionMembershipProof = {
|
|
|
75
78
|
artifactTreeLeafIndex: number;
|
|
76
79
|
};
|
|
77
80
|
|
|
78
|
-
const PrivateFunctionMembershipProofSchema =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
const PrivateFunctionMembershipProofSchema = zodFor<PrivateFunctionMembershipProof>()(
|
|
82
|
+
z.object({
|
|
83
|
+
artifactMetadataHash: schemas.Fr,
|
|
84
|
+
functionMetadataHash: schemas.Fr,
|
|
85
|
+
utilityFunctionsTreeRoot: schemas.Fr,
|
|
86
|
+
privateFunctionTreeSiblingPath: z.array(schemas.Fr),
|
|
87
|
+
privateFunctionTreeLeafIndex: schemas.Integer,
|
|
88
|
+
artifactTreeSiblingPath: z.array(schemas.Fr),
|
|
89
|
+
artifactTreeLeafIndex: schemas.Integer,
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
87
92
|
|
|
88
93
|
/** A private function with a membership proof. */
|
|
89
94
|
export type ExecutablePrivateFunctionWithMembershipProof = ExecutablePrivateFunction & PrivateFunctionMembershipProof;
|
|
@@ -97,23 +102,27 @@ export type UtilityFunctionMembershipProof = {
|
|
|
97
102
|
artifactTreeLeafIndex: number;
|
|
98
103
|
};
|
|
99
104
|
|
|
100
|
-
const UtilityFunctionMembershipProofSchema =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const UtilityFunctionMembershipProofSchema = zodFor<UtilityFunctionMembershipProof>()(
|
|
106
|
+
z.object({
|
|
107
|
+
artifactMetadataHash: schemas.Fr,
|
|
108
|
+
functionMetadataHash: schemas.Fr,
|
|
109
|
+
privateFunctionsArtifactTreeRoot: schemas.Fr,
|
|
110
|
+
artifactTreeSiblingPath: z.array(schemas.Fr),
|
|
111
|
+
artifactTreeLeafIndex: schemas.Integer,
|
|
112
|
+
}),
|
|
113
|
+
);
|
|
107
114
|
|
|
108
115
|
/** A utility function with a membership proof. */
|
|
109
116
|
export type UtilityFunctionWithMembershipProof = UtilityFunction & UtilityFunctionMembershipProof;
|
|
110
117
|
|
|
111
|
-
export const ContractClassSchema =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
export const ContractClassSchema = zodFor<ContractClass>()(
|
|
119
|
+
z.object({
|
|
120
|
+
version: z.literal(VERSION),
|
|
121
|
+
artifactHash: schemas.Fr,
|
|
122
|
+
privateFunctions: z.array(PrivateFunctionSchema),
|
|
123
|
+
packedBytecode: schemas.Buffer,
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
117
126
|
|
|
118
127
|
/** Commitments to fields of a contract class. */
|
|
119
128
|
interface ContractClassCommitments {
|
|
@@ -128,9 +137,11 @@ interface ContractClassCommitments {
|
|
|
128
137
|
/** A contract class with its precomputed id. */
|
|
129
138
|
export type ContractClassWithId = ContractClass & Pick<ContractClassCommitments, 'id'>;
|
|
130
139
|
|
|
131
|
-
export const ContractClassWithIdSchema =
|
|
132
|
-
|
|
133
|
-
|
|
140
|
+
export const ContractClassWithIdSchema = zodFor<ContractClassWithId>()(
|
|
141
|
+
ContractClassSchema.extend({
|
|
142
|
+
id: schemas.Fr,
|
|
143
|
+
}),
|
|
144
|
+
);
|
|
134
145
|
|
|
135
146
|
/** A contract class with public bytecode information, and optional private and utility functions. */
|
|
136
147
|
export type ContractClassPublic = {
|
|
@@ -142,14 +153,16 @@ export type ContractClassPublic = {
|
|
|
142
153
|
export type ContractClassPublicWithCommitment = ContractClassPublic &
|
|
143
154
|
Pick<ContractClassCommitments, 'publicBytecodeCommitment'>;
|
|
144
155
|
|
|
145
|
-
export const ContractClassPublicSchema =
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
156
|
+
export const ContractClassPublicSchema = zodFor<ContractClassPublic>()(
|
|
157
|
+
z
|
|
158
|
+
.object({
|
|
159
|
+
id: schemas.Fr,
|
|
160
|
+
privateFunctionsRoot: schemas.Fr,
|
|
161
|
+
privateFunctions: z.array(ExecutablePrivateFunctionSchema.and(PrivateFunctionMembershipProofSchema)),
|
|
162
|
+
utilityFunctions: z.array(UtilityFunctionSchema.and(UtilityFunctionMembershipProofSchema)),
|
|
163
|
+
})
|
|
164
|
+
.and(ContractClassSchema.omit({ privateFunctions: true })),
|
|
165
|
+
);
|
|
153
166
|
|
|
154
167
|
/** The contract class with the block it was initially deployed at */
|
|
155
168
|
export type ContractClassPublicWithBlockNumber = { l2BlockNumber: number } & ContractClassPublic;
|
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
|
|
5
5
|
import { AztecAddress } from '../../aztec-address/index.js';
|
|
6
6
|
import { PublicKeys } from '../../keys/public_keys.js';
|
|
7
|
-
import {
|
|
7
|
+
import { schemas, zodFor } from '../../schemas/index.js';
|
|
8
8
|
|
|
9
9
|
const VERSION = 1 as const;
|
|
10
10
|
|
|
@@ -32,19 +32,21 @@ export interface ContractInstance {
|
|
|
32
32
|
|
|
33
33
|
export type ContractInstanceWithAddress = ContractInstance & { address: AztecAddress };
|
|
34
34
|
|
|
35
|
-
export const ContractInstanceSchema =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
export const ContractInstanceSchema = zodFor<ContractInstance>()(
|
|
36
|
+
z.object({
|
|
37
|
+
version: z.literal(VERSION),
|
|
38
|
+
salt: schemas.Fr,
|
|
39
|
+
deployer: schemas.AztecAddress,
|
|
40
|
+
currentContractClassId: schemas.Fr,
|
|
41
|
+
originalContractClassId: schemas.Fr,
|
|
42
|
+
initializationHash: schemas.Fr,
|
|
43
|
+
publicKeys: PublicKeys.schema,
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
44
46
|
|
|
45
|
-
export const ContractInstanceWithAddressSchema =
|
|
46
|
-
z.object({ address: schemas.AztecAddress }),
|
|
47
|
-
)
|
|
47
|
+
export const ContractInstanceWithAddressSchema = zodFor<ContractInstanceWithAddress>()(
|
|
48
|
+
ContractInstanceSchema.and(z.object({ address: schemas.AztecAddress })),
|
|
49
|
+
);
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* Creates a ContractInstance from a plain object without Zod validation.
|
|
@@ -3,7 +3,7 @@ import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
import type { AztecAddress } from '../../aztec-address/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { schemas, zodFor } from '../../schemas/index.js';
|
|
7
7
|
import type { UInt64 } from '../../types/shared.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -20,12 +20,14 @@ export interface ContractInstanceUpdate {
|
|
|
20
20
|
|
|
21
21
|
export type ContractInstanceUpdateWithAddress = ContractInstanceUpdate & { address: AztecAddress };
|
|
22
22
|
|
|
23
|
-
export const ContractInstanceUpdateSchema =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export const ContractInstanceUpdateSchema = zodFor<ContractInstanceUpdate>()(
|
|
24
|
+
z.object({
|
|
25
|
+
prevContractClassId: schemas.Fr,
|
|
26
|
+
newContractClassId: schemas.Fr,
|
|
27
|
+
timestampOfChange: schemas.BigInt,
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
28
30
|
|
|
29
|
-
export const ContractInstanceUpdateWithAddressSchema =
|
|
30
|
-
z.object({ address: schemas.AztecAddress }),
|
|
31
|
-
)
|
|
31
|
+
export const ContractInstanceUpdateWithAddressSchema = zodFor<ContractInstanceUpdateWithAddress>()(
|
|
32
|
+
ContractInstanceUpdateSchema.and(z.object({ address: schemas.AztecAddress })),
|
|
33
|
+
);
|
|
@@ -2,7 +2,7 @@ import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { schemas, zodFor } from '../schemas/index.js';
|
|
6
6
|
|
|
7
7
|
export type L1RollupConstants = {
|
|
8
8
|
l1StartBlock: bigint;
|
|
@@ -22,14 +22,16 @@ export const EmptyL1RollupConstants: L1RollupConstants = {
|
|
|
22
22
|
proofSubmissionEpochs: 1,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
export const L1RollupConstantsSchema =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
export const L1RollupConstantsSchema = zodFor<L1RollupConstants>()(
|
|
26
|
+
z.object({
|
|
27
|
+
l1StartBlock: schemas.BigInt,
|
|
28
|
+
l1GenesisTime: schemas.BigInt,
|
|
29
|
+
slotDuration: z.number(),
|
|
30
|
+
epochDuration: z.number(),
|
|
31
|
+
ethereumSlotDuration: z.number(),
|
|
32
|
+
proofSubmissionEpochs: z.number(),
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
33
35
|
|
|
34
36
|
/** Returns the timestamp for a given L2 slot. */
|
|
35
37
|
export function getTimestampForSlot(
|
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
|
|
5
5
|
import type { FunctionSelector } from '../abi/function_selector.js';
|
|
6
6
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
-
import {
|
|
7
|
+
import { schemas, zodFor } from '../schemas/index.js';
|
|
8
8
|
|
|
9
9
|
type AllowedInstance = { address: AztecAddress };
|
|
10
10
|
type AllowedInstanceFunction = { address: AztecAddress; selector: FunctionSelector };
|
|
@@ -13,9 +13,11 @@ type AllowedClassFunction = { classId: Fr; selector: FunctionSelector };
|
|
|
13
13
|
|
|
14
14
|
export type AllowedElement = AllowedInstance | AllowedInstanceFunction | AllowedClass | AllowedClassFunction;
|
|
15
15
|
|
|
16
|
-
export const AllowedElementSchema =
|
|
17
|
-
z.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
export const AllowedElementSchema = zodFor<AllowedElement>()(
|
|
17
|
+
z.union([
|
|
18
|
+
z.object({ address: schemas.AztecAddress, selector: schemas.FunctionSelector }),
|
|
19
|
+
z.object({ address: schemas.AztecAddress }),
|
|
20
|
+
z.object({ classId: schemas.Fr, selector: schemas.FunctionSelector }),
|
|
21
|
+
z.object({ classId: schemas.Fr }),
|
|
22
|
+
]),
|
|
23
|
+
);
|
|
@@ -4,9 +4,9 @@ import type { ApiSchemaFor } from '@aztec/foundation/schemas';
|
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
|
+
import { CheckpointedL2Block, PublishedL2Block } from '../block/checkpointed_l2_block.js';
|
|
7
8
|
import { L2Block } from '../block/l2_block.js';
|
|
8
9
|
import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
|
|
9
|
-
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
10
10
|
import { ValidateBlockResultSchema } from '../block/validate_block_result.js';
|
|
11
11
|
import { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
12
12
|
import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
@@ -85,6 +85,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
85
85
|
.function()
|
|
86
86
|
.args(z.union([BlockNumberSchema, z.literal('latest')]))
|
|
87
87
|
.returns(BlockHeader.schema.optional()),
|
|
88
|
+
getCheckpointedBlock: z.function().args(BlockNumberSchema).returns(CheckpointedL2Block.schema.optional()),
|
|
88
89
|
getBlocks: z
|
|
89
90
|
.function()
|
|
90
91
|
.args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
|
|
@@ -93,7 +94,6 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
93
94
|
.function()
|
|
94
95
|
.args(CheckpointNumberSchema, schemas.Integer)
|
|
95
96
|
.returns(z.array(PublishedCheckpoint.schema)),
|
|
96
|
-
getCheckpointByArchive: z.function().args(schemas.Fr).returns(Checkpoint.schema.optional()),
|
|
97
97
|
getPublishedBlocks: z
|
|
98
98
|
.function()
|
|
99
99
|
.args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
|
|
@@ -21,10 +21,10 @@ import { z } from 'zod';
|
|
|
21
21
|
|
|
22
22
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
23
23
|
import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
|
|
24
|
+
import { PublishedL2Block } from '../block/checkpointed_l2_block.js';
|
|
24
25
|
import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
|
|
25
26
|
import { L2Block } from '../block/l2_block.js';
|
|
26
27
|
import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
27
|
-
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
28
28
|
import {
|
|
29
29
|
type ContractClassPublic,
|
|
30
30
|
ContractClassPublicSchema,
|
|
@@ -3,7 +3,7 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { schemas, zodFor } from '../schemas/index.js';
|
|
7
7
|
import { type AllowedElement, AllowedElementSchema } from './allowed_element.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -62,29 +62,32 @@ export interface SequencerConfig {
|
|
|
62
62
|
shuffleAttestationOrdering?: boolean;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
export const SequencerConfigSchema =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
65
|
+
export const SequencerConfigSchema = zodFor<SequencerConfig>()(
|
|
66
|
+
z.object({
|
|
67
|
+
transactionPollingIntervalMS: z.number().optional(),
|
|
68
|
+
maxTxsPerBlock: z.number().optional(),
|
|
69
|
+
minTxsPerBlock: z.number().optional(),
|
|
70
|
+
maxL2BlockGas: z.number().optional(),
|
|
71
|
+
publishTxsWithProposals: z.boolean().optional(),
|
|
72
|
+
maxDABlockGas: z.number().optional(),
|
|
73
|
+
coinbase: schemas.EthAddress.optional(),
|
|
74
|
+
feeRecipient: schemas.AztecAddress.optional(),
|
|
75
|
+
acvmWorkingDirectory: z.string().optional(),
|
|
76
|
+
acvmBinaryPath: z.string().optional(),
|
|
77
|
+
txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
|
|
78
|
+
maxBlockSizeInBytes: z.number().optional(),
|
|
79
|
+
governanceProposerPayload: schemas.EthAddress.optional(),
|
|
80
|
+
maxL1TxInclusionTimeIntoSlot: z.number().optional(),
|
|
81
|
+
enforceTimeTable: z.boolean().optional(),
|
|
82
|
+
fakeProcessingDelayPerTxMs: z.number().optional(),
|
|
83
|
+
attestationPropagationTime: z.number().optional(),
|
|
84
|
+
skipCollectingAttestations: z.boolean().optional(),
|
|
85
|
+
skipInvalidateBlockAsProposer: z.boolean().optional(),
|
|
86
|
+
secondsBeforeInvalidatingBlockAsCommitteeMember: z.number(),
|
|
87
|
+
secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
|
|
88
|
+
broadcastInvalidBlockProposal: z.boolean().optional(),
|
|
89
|
+
injectFakeAttestation: z.boolean().optional(),
|
|
90
|
+
fishermanMode: z.boolean().optional(),
|
|
91
|
+
shuffleAttestationOrdering: z.boolean().optional(),
|
|
92
|
+
}),
|
|
93
|
+
);
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
import { ExtendedContractClassLog } from '../logs/extended_contract_class_log.js';
|
|
4
4
|
import { ExtendedPublicLog } from '../logs/extended_public_log.js';
|
|
5
|
-
import
|
|
5
|
+
import { zodFor } from '../schemas/index.js';
|
|
6
6
|
|
|
7
7
|
/** Response for the getContractClassLogs archiver call. */
|
|
8
8
|
export type GetContractClassLogsResponse = {
|
|
@@ -12,10 +12,12 @@ export type GetContractClassLogsResponse = {
|
|
|
12
12
|
maxLogsHit: boolean;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export const GetContractClassLogsResponseSchema
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
export const GetContractClassLogsResponseSchema = zodFor<GetContractClassLogsResponse>()(
|
|
16
|
+
z.object({
|
|
17
|
+
logs: z.array(ExtendedContractClassLog.schema),
|
|
18
|
+
maxLogsHit: z.boolean(),
|
|
19
|
+
}),
|
|
20
|
+
);
|
|
19
21
|
|
|
20
22
|
/** Response for the getPublicLogs archiver call. */
|
|
21
23
|
export type GetPublicLogsResponse = {
|
|
@@ -25,7 +27,9 @@ export type GetPublicLogsResponse = {
|
|
|
25
27
|
maxLogsHit: boolean;
|
|
26
28
|
};
|
|
27
29
|
|
|
28
|
-
export const GetPublicLogsResponseSchema =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
export const GetPublicLogsResponseSchema = zodFor<GetPublicLogsResponse>()(
|
|
31
|
+
z.object({
|
|
32
|
+
logs: z.array(ExtendedPublicLog.schema),
|
|
33
|
+
maxLogsHit: z.boolean(),
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
@@ -3,7 +3,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { schemas, zodFor } from '../schemas/index.js';
|
|
7
7
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
8
8
|
import type { EpochProver } from './epoch-prover.js';
|
|
9
9
|
import type { ProvingJobConsumer } from './prover-broker.js';
|
|
@@ -33,15 +33,18 @@ export type ProverConfig = ActualProverConfig & {
|
|
|
33
33
|
failedProofStore?: string;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export const ProverConfigSchema =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
export const ProverConfigSchema = zodFor<ProverConfig>()(
|
|
37
|
+
z.object({
|
|
38
|
+
nodeUrl: z.string().optional(),
|
|
39
|
+
realProofs: z.boolean(),
|
|
40
|
+
proverId: schemas.EthAddress.optional(),
|
|
41
|
+
proverTestDelayType: z.enum(['fixed', 'realistic']),
|
|
42
|
+
proverTestDelayMs: z.number(),
|
|
43
|
+
proverTestDelayFactor: z.number(),
|
|
44
|
+
proverAgentCount: z.number(),
|
|
45
|
+
failedProofStore: z.string().optional(),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
45
48
|
|
|
46
49
|
export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
|
|
47
50
|
nodeUrl: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import {
|
|
2
|
+
import { schemas, zodFor } from '@aztec/foundation/schemas';
|
|
3
3
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
@@ -27,24 +27,26 @@ export interface SlasherConfig {
|
|
|
27
27
|
slashExecuteRoundsLookBack: number; // How many rounds to look back when searching for a round to execute
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export const SlasherConfigSchema =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
export const SlasherConfigSchema = zodFor<SlasherConfig>()(
|
|
31
|
+
z.object({
|
|
32
|
+
slashOverridePayload: schemas.EthAddress.optional(),
|
|
33
|
+
slashMinPenaltyPercentage: z.number(),
|
|
34
|
+
slashMaxPenaltyPercentage: z.number(),
|
|
35
|
+
slashValidatorsAlways: z.array(schemas.EthAddress),
|
|
36
|
+
slashValidatorsNever: z.array(schemas.EthAddress),
|
|
37
|
+
slashPrunePenalty: schemas.BigInt,
|
|
38
|
+
slashDataWithholdingPenalty: schemas.BigInt,
|
|
39
|
+
slashInactivityTargetPercentage: z.number(),
|
|
40
|
+
slashInactivityConsecutiveEpochThreshold: z.number(),
|
|
41
|
+
slashInactivityPenalty: schemas.BigInt,
|
|
42
|
+
slashProposeInvalidAttestationsPenalty: schemas.BigInt,
|
|
43
|
+
slashAttestDescendantOfInvalidPenalty: schemas.BigInt,
|
|
44
|
+
slashUnknownPenalty: schemas.BigInt,
|
|
45
|
+
slashOffenseExpirationRounds: z.number(),
|
|
46
|
+
slashMaxPayloadSize: z.number(),
|
|
47
|
+
slashGracePeriodL2Slots: z.number(),
|
|
48
|
+
slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
|
|
49
|
+
slashExecuteRoundsLookBack: z.number(),
|
|
50
|
+
slashSelfAllowed: z.boolean().optional(),
|
|
51
|
+
}),
|
|
52
|
+
);
|