@aztec/stdlib 0.0.1-commit.cd76b27 → 0.0.1-commit.d117d021b
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/decoder.d.ts +2 -2
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +7 -5
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +37 -6
- package/dest/abi/event_metadata_definition.d.ts +3 -1
- package/dest/abi/event_metadata_definition.d.ts.map +1 -1
- package/dest/abi/event_metadata_definition.js +1 -1
- package/dest/abi/utils.d.ts +14 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +15 -0
- package/dest/avm/avm.d.ts +300 -300
- package/dest/avm/avm_proving_request.d.ts +166 -166
- package/dest/avm/revert_code.d.ts +16 -1
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +15 -5
- package/dest/block/l2_block.d.ts +9 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +12 -2
- package/dest/block/l2_block_source.d.ts +6 -1
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +1 -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 +10 -0
- package/dest/checkpoint/checkpoint.d.ts +2 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +9 -4
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/validate.d.ts +36 -0
- package/dest/checkpoint/validate.d.ts.map +1 -0
- package/dest/checkpoint/validate.js +120 -0
- package/dest/config/sequencer-config.d.ts +4 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +6 -0
- package/dest/contract/contract_class.d.ts +2 -3
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/gas/gas_fees.d.ts +1 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +4 -1
- package/dest/ha-signing/config.d.ts +136 -0
- package/dest/ha-signing/config.d.ts.map +1 -0
- package/dest/ha-signing/config.js +97 -0
- package/dest/ha-signing/index.d.ts +4 -0
- package/dest/ha-signing/index.d.ts.map +1 -0
- package/dest/ha-signing/index.js +3 -0
- package/dest/ha-signing/local_config.d.ts +63 -0
- package/dest/ha-signing/local_config.d.ts.map +1 -0
- package/dest/ha-signing/local_config.js +24 -0
- package/dest/ha-signing/types.d.ts +85 -0
- package/dest/ha-signing/types.d.ts.map +1 -0
- package/dest/ha-signing/types.js +32 -0
- package/dest/interfaces/allowed_element.d.ts +26 -20
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +8 -8
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +1 -0
- package/dest/interfaces/aztec-node-admin.d.ts +70 -30
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +10 -5
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +3 -2
- package/dest/interfaces/block-builder.d.ts +11 -5
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +7 -2
- package/dest/interfaces/configs.d.ts +57 -32
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +5 -2
- package/dest/interfaces/p2p.d.ts +3 -8
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +103 -41
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +8 -4
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +13 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +13 -10
- package/dest/kernel/hints/build_transient_data_hints.d.ts +5 -2
- package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_transient_data_hints.js +9 -3
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
- package/dest/kv-store/config.d.ts +17 -0
- package/dest/kv-store/config.d.ts.map +1 -0
- package/dest/kv-store/config.js +26 -0
- package/dest/kv-store/index.d.ts +2 -0
- package/dest/kv-store/index.d.ts.map +1 -0
- package/dest/kv-store/index.js +1 -0
- package/dest/logs/debug_log_store.d.ts +30 -0
- package/dest/logs/debug_log_store.d.ts.map +1 -0
- package/dest/logs/debug_log_store.js +30 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts +47 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -0
- package/dest/logs/{directional_app_tagging_secret.js → extended_directional_app_tagging_secret.js} +23 -15
- package/dest/logs/index.d.ts +3 -2
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +2 -1
- package/dest/logs/pre_tag.d.ts +16 -11
- package/dest/logs/pre_tag.d.ts.map +1 -1
- package/dest/logs/pre_tag.js +2 -2
- package/dest/logs/public_log.d.ts +4 -3
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +2 -1
- package/dest/logs/siloed_tag.d.ts +5 -3
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +6 -1
- package/dest/logs/tag.js +1 -1
- package/dest/p2p/attestation_utils.d.ts +11 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +45 -0
- package/dest/p2p/block_proposal.d.ts +2 -2
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +2 -7
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +1 -13
- package/dest/p2p/client_type.d.ts +2 -5
- package/dest/p2p/client_type.d.ts.map +1 -1
- package/dest/p2p/client_type.js +0 -7
- package/dest/p2p/index.d.ts +1 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +0 -1
- package/dest/p2p/peer_error.d.ts +3 -1
- package/dest/p2p/peer_error.d.ts.map +1 -1
- package/dest/p2p/peer_error.js +5 -0
- package/dest/p2p/topic_type.d.ts +3 -4
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +7 -24
- package/dest/slashing/tally.d.ts +7 -2
- package/dest/slashing/tally.d.ts.map +1 -1
- package/dest/slashing/tally.js +30 -2
- package/dest/tests/factories.d.ts +3 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +8 -0
- package/dest/tests/mocks.d.ts +5 -3
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +18 -13
- package/dest/tx/block_header.d.ts +3 -1
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +4 -0
- package/dest/tx/public_simulation_output.d.ts +4 -2
- package/dest/tx/public_simulation_output.d.ts.map +1 -1
- package/dest/tx/public_simulation_output.js +7 -3
- package/dest/tx/simulated_tx.d.ts +5 -2
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +4 -1
- package/dest/tx/tx.d.ts +6 -5
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +18 -6
- package/dest/tx/tx_receipt.d.ts +16 -2
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +11 -3
- package/dest/tx/validator/error_texts.d.ts +5 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +4 -0
- package/dest/update-checker/index.d.ts +3 -2
- package/dest/update-checker/index.d.ts.map +1 -1
- package/dest/update-checker/index.js +2 -1
- package/dest/update-checker/package_version.d.ts +3 -0
- package/dest/update-checker/package_version.d.ts.map +1 -0
- package/dest/update-checker/package_version.js +11 -0
- package/dest/update-checker/version_checker.d.ts +25 -0
- package/dest/update-checker/version_checker.d.ts.map +1 -0
- package/dest/update-checker/version_checker.js +50 -0
- package/package.json +12 -11
- package/src/abi/decoder.ts +15 -6
- package/src/abi/encoder.ts +49 -6
- package/src/abi/event_metadata_definition.ts +2 -0
- package/src/abi/utils.ts +25 -0
- package/src/avm/revert_code.ts +15 -0
- package/src/block/l2_block.ts +13 -1
- package/src/block/l2_block_source.ts +6 -0
- package/src/block/l2_block_stream/l2_block_stream.ts +21 -0
- package/src/checkpoint/checkpoint.ts +12 -3
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/validate.ts +230 -0
- package/src/config/sequencer-config.ts +9 -1
- package/src/contract/contract_class.ts +3 -3
- package/src/gas/gas_fees.ts +7 -1
- package/src/ha-signing/config.ts +156 -0
- package/src/ha-signing/index.ts +27 -0
- package/src/ha-signing/local_config.ts +46 -0
- package/src/ha-signing/types.ts +112 -0
- package/src/interfaces/allowed_element.ts +29 -9
- package/src/interfaces/archiver.ts +1 -0
- package/src/interfaces/aztec-node.ts +14 -4
- package/src/interfaces/block-builder.ts +25 -5
- package/src/interfaces/configs.ts +22 -8
- package/src/interfaces/p2p.ts +2 -13
- package/src/interfaces/validator.ts +50 -28
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +14 -18
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +15 -18
- package/src/kernel/hints/build_transient_data_hints.ts +17 -2
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
- package/src/kv-store/config.ts +36 -0
- package/src/kv-store/index.ts +1 -0
- package/src/logs/debug_log_store.ts +54 -0
- package/src/logs/{directional_app_tagging_secret.ts → extended_directional_app_tagging_secret.ts} +24 -16
- package/src/logs/index.ts +2 -1
- package/src/logs/pre_tag.ts +5 -5
- package/src/logs/public_log.ts +4 -2
- package/src/logs/siloed_tag.ts +8 -2
- package/src/logs/tag.ts +1 -1
- package/src/p2p/attestation_utils.ts +56 -0
- package/src/p2p/block_proposal.ts +1 -1
- package/src/p2p/checkpoint_proposal.ts +1 -18
- package/src/p2p/client_type.ts +0 -6
- package/src/p2p/index.ts +0 -1
- package/src/p2p/peer_error.ts +7 -0
- package/src/p2p/topic_type.ts +8 -15
- package/src/slashing/tally.ts +34 -1
- package/src/tests/factories.ts +9 -0
- package/src/tests/mocks.ts +25 -10
- package/src/tx/block_header.ts +6 -0
- package/src/tx/public_simulation_output.ts +4 -0
- package/src/tx/simulated_tx.ts +8 -1
- package/src/tx/tx.ts +20 -11
- package/src/tx/tx_receipt.ts +10 -0
- package/src/tx/validator/error_texts.ts +4 -0
- package/src/update-checker/index.ts +2 -1
- package/src/update-checker/package_version.ts +17 -0
- package/src/update-checker/version_checker.ts +65 -0
- package/dest/logs/directional_app_tagging_secret.d.ts +0 -40
- package/dest/logs/directional_app_tagging_secret.d.ts.map +0 -1
- package/dest/update-checker/update-checker.d.ts +0 -49
- package/dest/update-checker/update-checker.d.ts.map +0 -1
- package/dest/update-checker/update-checker.js +0 -130
- package/src/update-checker/update-checker.ts +0 -166
|
@@ -86,6 +86,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
86
86
|
getBlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
87
87
|
getProvenBlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
88
88
|
getCheckpointedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
89
|
+
getCheckpointNumber: z.function().args().returns(CheckpointNumberSchema),
|
|
89
90
|
getFinalizedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
90
91
|
getBlock: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
|
|
91
92
|
getBlockHeader: z
|
|
@@ -4,7 +4,9 @@ import {
|
|
|
4
4
|
BlockNumber,
|
|
5
5
|
BlockNumberPositiveSchema,
|
|
6
6
|
BlockNumberSchema,
|
|
7
|
+
CheckpointNumber,
|
|
7
8
|
CheckpointNumberPositiveSchema,
|
|
9
|
+
CheckpointNumberSchema,
|
|
8
10
|
EpochNumber,
|
|
9
11
|
EpochNumberSchema,
|
|
10
12
|
type SlotNumber,
|
|
@@ -172,14 +174,14 @@ export interface AztecNode
|
|
|
172
174
|
l1ToL2Message: Fr,
|
|
173
175
|
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined>;
|
|
174
176
|
|
|
175
|
-
/** Returns the L2
|
|
176
|
-
|
|
177
|
+
/** Returns the L2 checkpoint number in which this L1 to L2 message becomes available, or undefined if not found. */
|
|
178
|
+
getL1ToL2MessageCheckpoint(l1ToL2Message: Fr): Promise<CheckpointNumber | undefined>;
|
|
177
179
|
|
|
178
180
|
/**
|
|
179
181
|
* Returns whether an L1 to L2 message is synced by archiver.
|
|
180
182
|
* @param l1ToL2Message - The L1 to L2 message to check.
|
|
181
183
|
* @returns Whether the message is synced.
|
|
182
|
-
* @deprecated Use `
|
|
184
|
+
* @deprecated Use `getL1ToL2MessageCheckpoint` instead. This method may return true even if the message is not ready to use.
|
|
183
185
|
*/
|
|
184
186
|
isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
|
|
185
187
|
|
|
@@ -230,6 +232,12 @@ export interface AztecNode
|
|
|
230
232
|
*/
|
|
231
233
|
getCheckpointedBlockNumber(): Promise<BlockNumber>;
|
|
232
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Method to fetch the latest checkpoint number synchronized by the node.
|
|
237
|
+
* @returns The checkpoint number.
|
|
238
|
+
*/
|
|
239
|
+
getCheckpointNumber(): Promise<CheckpointNumber>;
|
|
240
|
+
|
|
233
241
|
/**
|
|
234
242
|
* Method to determine if the node is ready to accept transactions.
|
|
235
243
|
* @returns - Flag indicating the readiness for tx submission.
|
|
@@ -517,7 +525,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
517
525
|
.args(BlockParameterSchema, schemas.Fr)
|
|
518
526
|
.returns(z.tuple([schemas.BigInt, SiblingPath.schemaFor(L1_TO_L2_MSG_TREE_HEIGHT)]).optional()),
|
|
519
527
|
|
|
520
|
-
|
|
528
|
+
getL1ToL2MessageCheckpoint: z.function().args(schemas.Fr).returns(CheckpointNumberSchema.optional()),
|
|
521
529
|
|
|
522
530
|
isL1ToL2MessageSynced: z.function().args(schemas.Fr).returns(z.boolean()),
|
|
523
531
|
|
|
@@ -534,6 +542,8 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
534
542
|
|
|
535
543
|
getBlockNumber: z.function().returns(BlockNumberSchema),
|
|
536
544
|
|
|
545
|
+
getCheckpointNumber: z.function().returns(CheckpointNumberSchema),
|
|
546
|
+
|
|
537
547
|
getProvenBlockNumber: z.function().returns(BlockNumberSchema),
|
|
538
548
|
|
|
539
549
|
getCheckpointedBlockNumber: z.function().returns(BlockNumberSchema),
|
|
@@ -36,11 +36,16 @@ export interface IBlockFactory extends ProcessedTxHandler {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export interface PublicProcessorLimits {
|
|
39
|
+
/** Maximum number of txs to process. */
|
|
39
40
|
maxTransactions?: number;
|
|
40
|
-
|
|
41
|
+
/** L2 and DA gas limits. */
|
|
41
42
|
maxBlockGas?: Gas;
|
|
43
|
+
/** Maximum number of blob fields allowed. */
|
|
42
44
|
maxBlobFields?: number;
|
|
45
|
+
/** Deadline for processing the txs. Processor will stop as soon as it hits this time. */
|
|
43
46
|
deadline?: Date;
|
|
47
|
+
/** Whether this processor is building a proposal (as opposed to re-executing one). Skipping txs due to gas or blob limits is only done during proposal building. */
|
|
48
|
+
isBuildingProposal?: boolean;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
export interface PublicProcessorValidator {
|
|
@@ -50,16 +55,33 @@ export interface PublicProcessorValidator {
|
|
|
50
55
|
|
|
51
56
|
export type FullNodeBlockBuilderConfig = Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'> &
|
|
52
57
|
Pick<ChainConfig, 'l1ChainId' | 'rollupVersion'> &
|
|
53
|
-
Pick<
|
|
58
|
+
Pick<
|
|
59
|
+
SequencerConfig,
|
|
60
|
+
| 'txPublicSetupAllowListExtend'
|
|
61
|
+
| 'fakeProcessingDelayPerTxMs'
|
|
62
|
+
| 'fakeThrowAfterProcessingTxCount'
|
|
63
|
+
| 'maxTxsPerBlock'
|
|
64
|
+
| 'maxTxsPerCheckpoint'
|
|
65
|
+
| 'maxL2BlockGas'
|
|
66
|
+
| 'maxDABlockGas'
|
|
67
|
+
> & {
|
|
68
|
+
/** Total L2 gas (mana) allowed per checkpoint. Fetched from L1 getManaLimit(). */
|
|
69
|
+
rollupManaLimit: number;
|
|
70
|
+
};
|
|
54
71
|
|
|
55
72
|
export const FullNodeBlockBuilderConfigKeys: (keyof FullNodeBlockBuilderConfig)[] = [
|
|
56
73
|
'l1GenesisTime',
|
|
57
74
|
'slotDuration',
|
|
58
75
|
'l1ChainId',
|
|
59
76
|
'rollupVersion',
|
|
60
|
-
'
|
|
77
|
+
'txPublicSetupAllowListExtend',
|
|
61
78
|
'fakeProcessingDelayPerTxMs',
|
|
62
79
|
'fakeThrowAfterProcessingTxCount',
|
|
80
|
+
'maxTxsPerBlock',
|
|
81
|
+
'maxTxsPerCheckpoint',
|
|
82
|
+
'maxL2BlockGas',
|
|
83
|
+
'maxDABlockGas',
|
|
84
|
+
'rollupManaLimit',
|
|
63
85
|
] as const;
|
|
64
86
|
|
|
65
87
|
/** Thrown when no valid transactions are available to include in a block after processing, and this is not the first block in a checkpoint. */
|
|
@@ -73,12 +95,10 @@ export class NoValidTxsError extends Error {
|
|
|
73
95
|
/** Result of building a block within a checkpoint. */
|
|
74
96
|
export type BuildBlockInCheckpointResult = {
|
|
75
97
|
block: L2Block;
|
|
76
|
-
publicGas: Gas;
|
|
77
98
|
publicProcessorDuration: number;
|
|
78
99
|
numTxs: number;
|
|
79
100
|
failedTxs: FailedTx[];
|
|
80
101
|
usedTxs: Tx[];
|
|
81
|
-
usedTxBlobFields: number;
|
|
82
102
|
};
|
|
83
103
|
|
|
84
104
|
/** Interface for building blocks within a checkpoint context. */
|
|
@@ -13,6 +13,8 @@ export interface SequencerConfig {
|
|
|
13
13
|
sequencerPollingIntervalMS?: number;
|
|
14
14
|
/** The maximum number of txs to include in a block. */
|
|
15
15
|
maxTxsPerBlock?: number;
|
|
16
|
+
/** The maximum number of txs across all blocks in a checkpoint. */
|
|
17
|
+
maxTxsPerCheckpoint?: number;
|
|
16
18
|
/** The minimum number of txs to include in a block. */
|
|
17
19
|
minTxsPerBlock?: number;
|
|
18
20
|
/** The minimum number of valid txs (after execution) to include in a block. If not set, falls back to minTxsPerBlock. */
|
|
@@ -23,6 +25,8 @@ export interface SequencerConfig {
|
|
|
23
25
|
maxL2BlockGas?: number;
|
|
24
26
|
/** The maximum DA block gas. */
|
|
25
27
|
maxDABlockGas?: number;
|
|
28
|
+
/** Per-block gas budget multiplier for both L2 and DA gas. Budget = (checkpointLimit / maxBlocks) * multiplier. */
|
|
29
|
+
perBlockAllocationMultiplier?: number;
|
|
26
30
|
/** Recipient of block reward. */
|
|
27
31
|
coinbase?: EthAddress;
|
|
28
32
|
/** Address to receive fees. */
|
|
@@ -31,10 +35,8 @@ export interface SequencerConfig {
|
|
|
31
35
|
acvmWorkingDirectory?: string;
|
|
32
36
|
/** The path to the ACVM binary */
|
|
33
37
|
acvmBinaryPath?: string;
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
/** Max block size */
|
|
37
|
-
maxBlockSizeInBytes?: number;
|
|
38
|
+
/** Additional entries to extend the default setup allow list. */
|
|
39
|
+
txPublicSetupAllowListExtend?: AllowedElement[];
|
|
38
40
|
/** Payload address to vote for */
|
|
39
41
|
governanceProposerPayload?: EthAddress;
|
|
40
42
|
/** Whether to enforce the time table when building blocks */
|
|
@@ -59,6 +61,10 @@ export interface SequencerConfig {
|
|
|
59
61
|
broadcastInvalidBlockProposal?: boolean;
|
|
60
62
|
/** Inject a fake attestation (for testing only) */
|
|
61
63
|
injectFakeAttestation?: boolean;
|
|
64
|
+
/** Inject a malleable attestation with a high-s value (for testing only) */
|
|
65
|
+
injectHighSValueAttestation?: boolean;
|
|
66
|
+
/** Inject an attestation with an unrecoverable signature (for testing only) */
|
|
67
|
+
injectUnrecoverableSignatureAttestation?: boolean;
|
|
62
68
|
/** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing */
|
|
63
69
|
fishermanMode?: boolean;
|
|
64
70
|
/** Shuffle attestation ordering to create invalid ordering (for testing only) */
|
|
@@ -81,17 +87,18 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
|
|
|
81
87
|
z.object({
|
|
82
88
|
sequencerPollingIntervalMS: z.number().optional(),
|
|
83
89
|
maxTxsPerBlock: z.number().optional(),
|
|
90
|
+
maxTxsPerCheckpoint: z.number().optional(),
|
|
84
91
|
minValidTxsPerBlock: z.number().optional(),
|
|
85
92
|
minTxsPerBlock: z.number().optional(),
|
|
86
93
|
maxL2BlockGas: z.number().optional(),
|
|
87
94
|
publishTxsWithProposals: z.boolean().optional(),
|
|
88
95
|
maxDABlockGas: z.number().optional(),
|
|
96
|
+
perBlockAllocationMultiplier: z.number().optional(),
|
|
89
97
|
coinbase: schemas.EthAddress.optional(),
|
|
90
98
|
feeRecipient: schemas.AztecAddress.optional(),
|
|
91
99
|
acvmWorkingDirectory: z.string().optional(),
|
|
92
100
|
acvmBinaryPath: z.string().optional(),
|
|
93
|
-
|
|
94
|
-
maxBlockSizeInBytes: z.number().optional(),
|
|
101
|
+
txPublicSetupAllowListExtend: z.array(AllowedElementSchema).optional(),
|
|
95
102
|
governanceProposerPayload: schemas.EthAddress.optional(),
|
|
96
103
|
l1PublishingTime: z.number().optional(),
|
|
97
104
|
enforceTimeTable: z.boolean().optional(),
|
|
@@ -104,6 +111,8 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
|
|
|
104
111
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
|
|
105
112
|
broadcastInvalidBlockProposal: z.boolean().optional(),
|
|
106
113
|
injectFakeAttestation: z.boolean().optional(),
|
|
114
|
+
injectHighSValueAttestation: z.boolean().optional(),
|
|
115
|
+
injectUnrecoverableSignatureAttestation: z.boolean().optional(),
|
|
107
116
|
fishermanMode: z.boolean().optional(),
|
|
108
117
|
shuffleAttestationOrdering: z.boolean().optional(),
|
|
109
118
|
blockDurationMs: z.number().positive().optional(),
|
|
@@ -126,9 +135,14 @@ type SequencerConfigOptionalKeys =
|
|
|
126
135
|
| 'fakeProcessingDelayPerTxMs'
|
|
127
136
|
| 'fakeThrowAfterProcessingTxCount'
|
|
128
137
|
| 'l1PublishingTime'
|
|
129
|
-
| '
|
|
138
|
+
| 'txPublicSetupAllowListExtend'
|
|
130
139
|
| 'minValidTxsPerBlock'
|
|
131
|
-
| 'minBlocksForCheckpoint'
|
|
140
|
+
| 'minBlocksForCheckpoint'
|
|
141
|
+
| 'maxTxsPerBlock'
|
|
142
|
+
| 'maxTxsPerCheckpoint'
|
|
143
|
+
| 'maxL2BlockGas'
|
|
144
|
+
| 'maxDABlockGas'
|
|
145
|
+
| 'perBlockAllocationMultiplier';
|
|
132
146
|
|
|
133
147
|
export type ResolvedSequencerConfig = Prettify<
|
|
134
148
|
Required<Omit<SequencerConfig, SequencerConfigOptionalKeys>> & Pick<SequencerConfig, SequencerConfigOptionalKeys>
|
package/src/interfaces/p2p.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
import { CheckpointAttestation } from '../p2p/checkpoint_attestation.js';
|
|
6
|
-
import type { P2PClientType } from '../p2p/client_type.js';
|
|
7
6
|
import { type ApiSchemaFor, optional, schemas } from '../schemas/index.js';
|
|
8
7
|
import { Tx } from '../tx/tx.js';
|
|
9
8
|
import { TxHash } from '../tx/tx_hash.js';
|
|
@@ -27,7 +26,7 @@ const PeerInfoSchema = z.discriminatedUnion('status', [
|
|
|
27
26
|
]);
|
|
28
27
|
|
|
29
28
|
/** Exposed API to the P2P module. */
|
|
30
|
-
export interface
|
|
29
|
+
export interface P2PApi {
|
|
31
30
|
/**
|
|
32
31
|
* Returns all pending transactions in the transaction pool.
|
|
33
32
|
* @param limit - The number of items to returns
|
|
@@ -48,9 +47,7 @@ export interface P2PApiWithoutAttestations {
|
|
|
48
47
|
* Returns info for all connected, dialing, and cached peers.
|
|
49
48
|
*/
|
|
50
49
|
getPeers(includePending?: boolean): Promise<PeerInfo[]>;
|
|
51
|
-
}
|
|
52
50
|
|
|
53
|
-
export interface P2PApiWithAttestations extends P2PApiWithoutAttestations {
|
|
54
51
|
/**
|
|
55
52
|
* Queries the Attestation pool for checkpoint attestations for the given slot
|
|
56
53
|
*
|
|
@@ -61,19 +58,11 @@ export interface P2PApiWithAttestations extends P2PApiWithoutAttestations {
|
|
|
61
58
|
getCheckpointAttestationsForSlot(slot: SlotNumber, proposalId?: string): Promise<CheckpointAttestation[]>;
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
export interface P2PClient extends
|
|
61
|
+
export interface P2PClient extends P2PApi {
|
|
65
62
|
/** Manually adds checkpoint attestations to the p2p client attestation pool. */
|
|
66
63
|
addOwnCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void>;
|
|
67
64
|
}
|
|
68
65
|
|
|
69
|
-
export type P2PApi<T extends P2PClientType = P2PClientType.Full> = T extends P2PClientType.Full
|
|
70
|
-
? P2PApiWithAttestations
|
|
71
|
-
: P2PApiWithoutAttestations;
|
|
72
|
-
|
|
73
|
-
export type P2PApiFull<T extends P2PClientType = P2PClientType.Full> = T extends P2PClientType.Full
|
|
74
|
-
? P2PApiWithAttestations & P2PClient
|
|
75
|
-
: P2PApiWithoutAttestations;
|
|
76
|
-
|
|
77
66
|
export const P2PApiSchema: ApiSchemaFor<P2PApi> = {
|
|
78
67
|
getCheckpointAttestationsForSlot: z
|
|
79
68
|
.function()
|
|
@@ -15,54 +15,72 @@ import type {
|
|
|
15
15
|
} from '@aztec/stdlib/p2p';
|
|
16
16
|
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
17
17
|
import type { BlockHeader, Tx } from '@aztec/stdlib/tx';
|
|
18
|
-
import { type ValidatorHASignerConfig, ValidatorHASignerConfigSchema } from '@aztec/validator-ha-signer/config';
|
|
19
18
|
|
|
20
19
|
import type { PeerId } from '@libp2p/interface';
|
|
21
20
|
import { z } from 'zod';
|
|
22
21
|
|
|
23
22
|
import type { CommitteeAttestationsAndSigners } from '../block/index.js';
|
|
23
|
+
import {
|
|
24
|
+
type LocalSignerConfig,
|
|
25
|
+
LocalSignerConfigSchema,
|
|
26
|
+
type ValidatorHASignerConfig,
|
|
27
|
+
ValidatorHASignerConfigSchema,
|
|
28
|
+
} from '../ha-signing/index.js';
|
|
24
29
|
import { AllowedElementSchema } from './allowed_element.js';
|
|
25
30
|
|
|
26
31
|
/**
|
|
27
32
|
* Validator client configuration
|
|
28
33
|
*/
|
|
29
|
-
export type ValidatorClientConfig = ValidatorHASignerConfig &
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
export type ValidatorClientConfig = ValidatorHASignerConfig &
|
|
35
|
+
LocalSignerConfig & {
|
|
36
|
+
/** The private keys of the validators participating in attestation duties */
|
|
37
|
+
validatorPrivateKeys?: SecretValue<`0x${string}`[]>;
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
/** The addresses of the validators to use with remote signers */
|
|
40
|
+
validatorAddresses?: EthAddress[];
|
|
35
41
|
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
/** Do not run the validator */
|
|
43
|
+
disableValidator: boolean;
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
/** Temporarily disable these specific validator addresses */
|
|
46
|
+
disabledValidators: EthAddress[];
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
/** Interval between polling for new attestations from peers */
|
|
49
|
+
attestationPollingIntervalMs: number;
|
|
44
50
|
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
/** Whether to re-execute transactions in a block proposal before attesting */
|
|
52
|
+
validatorReexecute: boolean;
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
/** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
|
|
55
|
+
alwaysReexecuteBlockProposals?: boolean;
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
/** Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus */
|
|
58
|
+
fishermanMode?: boolean;
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
/** Skip checkpoint proposal validation and always attest (default: false) */
|
|
61
|
+
skipCheckpointProposalValidation?: boolean;
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
/** Skip pushing re-executed blocks to archiver (default: false) */
|
|
64
|
+
skipPushProposedBlocksToArchiver?: boolean;
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
/** Agree to attest to equivocated checkpoint proposals (for testing purposes only) */
|
|
67
|
+
attestToEquivocatedProposals?: boolean;
|
|
68
|
+
|
|
69
|
+
/** Maximum L2 gas per block for validation. Proposals exceeding this limit are rejected. */
|
|
70
|
+
validateMaxL2BlockGas?: number;
|
|
71
|
+
|
|
72
|
+
/** Maximum DA gas per block for validation. Proposals exceeding this limit are rejected. */
|
|
73
|
+
validateMaxDABlockGas?: number;
|
|
74
|
+
|
|
75
|
+
/** Maximum transactions per block for validation. Proposals exceeding this limit are rejected. */
|
|
76
|
+
validateMaxTxsPerBlock?: number;
|
|
77
|
+
|
|
78
|
+
/** Maximum transactions per checkpoint for validation. Proposals exceeding this limit are rejected. */
|
|
79
|
+
validateMaxTxsPerCheckpoint?: number;
|
|
80
|
+
};
|
|
63
81
|
|
|
64
82
|
export type ValidatorClientFullConfig = ValidatorClientConfig &
|
|
65
|
-
Pick<SequencerConfig, '
|
|
83
|
+
Pick<SequencerConfig, 'txPublicSetupAllowListExtend' | 'broadcastInvalidBlockProposal'> &
|
|
66
84
|
Pick<
|
|
67
85
|
SlasherConfig,
|
|
68
86
|
'slashBroadcastedInvalidBlockPenalty' | 'slashDuplicateProposalPenalty' | 'slashDuplicateAttestationPenalty'
|
|
@@ -75,7 +93,7 @@ export type ValidatorClientFullConfig = ValidatorClientConfig &
|
|
|
75
93
|
};
|
|
76
94
|
|
|
77
95
|
export const ValidatorClientConfigSchema = zodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>()(
|
|
78
|
-
ValidatorHASignerConfigSchema.extend({
|
|
96
|
+
ValidatorHASignerConfigSchema.merge(LocalSignerConfigSchema).extend({
|
|
79
97
|
validatorAddresses: z.array(schemas.EthAddress).optional(),
|
|
80
98
|
disableValidator: z.boolean(),
|
|
81
99
|
disabledValidators: z.array(schemas.EthAddress),
|
|
@@ -86,12 +104,16 @@ export const ValidatorClientConfigSchema = zodFor<Omit<ValidatorClientConfig, 'v
|
|
|
86
104
|
skipCheckpointProposalValidation: z.boolean().optional(),
|
|
87
105
|
skipPushProposedBlocksToArchiver: z.boolean().optional(),
|
|
88
106
|
attestToEquivocatedProposals: z.boolean().optional(),
|
|
107
|
+
validateMaxL2BlockGas: z.number().optional(),
|
|
108
|
+
validateMaxDABlockGas: z.number().optional(),
|
|
109
|
+
validateMaxTxsPerBlock: z.number().optional(),
|
|
110
|
+
validateMaxTxsPerCheckpoint: z.number().optional(),
|
|
89
111
|
}),
|
|
90
112
|
);
|
|
91
113
|
|
|
92
114
|
export const ValidatorClientFullConfigSchema = zodFor<Omit<ValidatorClientFullConfig, 'validatorPrivateKeys'>>()(
|
|
93
115
|
ValidatorClientConfigSchema.extend({
|
|
94
|
-
|
|
116
|
+
txPublicSetupAllowListExtend: z.array(AllowedElementSchema).optional(),
|
|
95
117
|
broadcastInvalidBlockProposal: z.boolean().optional(),
|
|
96
118
|
slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
|
|
97
119
|
slashDuplicateProposalPenalty: schemas.BigInt,
|
|
@@ -11,7 +11,6 @@ import type { ScopedNoteHash } from '../note_hash.js';
|
|
|
11
11
|
import { NoteHashReadRequestHintsBuilder } from './note_hash_read_request_hints.js';
|
|
12
12
|
import type { ScopedReadRequest } from './read_request.js';
|
|
13
13
|
import { PendingReadHint, ReadRequestActionEnum, ReadRequestResetActions } from './read_request_hints.js';
|
|
14
|
-
import { ScopedValueCache } from './scoped_value_cache.js';
|
|
15
14
|
|
|
16
15
|
export function isValidNoteHashReadRequest(readRequest: ScopedReadRequest, noteHash: ScopedNoteHash) {
|
|
17
16
|
return (
|
|
@@ -24,7 +23,6 @@ export function isValidNoteHashReadRequest(readRequest: ScopedReadRequest, noteH
|
|
|
24
23
|
export function getNoteHashReadRequestResetActions(
|
|
25
24
|
noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>,
|
|
26
25
|
noteHashes: ClaimedLengthArray<ScopedNoteHash, typeof MAX_NOTE_HASHES_PER_TX>,
|
|
27
|
-
futureNoteHashes: ScopedNoteHash[],
|
|
28
26
|
): ReadRequestResetActions<typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX> {
|
|
29
27
|
const resetActions = ReadRequestResetActions.empty(MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
30
28
|
|
|
@@ -36,24 +34,23 @@ export function getNoteHashReadRequestResetActions(
|
|
|
36
34
|
noteHashMap.set(value, arr);
|
|
37
35
|
});
|
|
38
36
|
|
|
39
|
-
const futureNoteHashMap = new ScopedValueCache(futureNoteHashes);
|
|
40
|
-
|
|
41
37
|
for (let i = 0; i < noteHashReadRequests.claimedLength; ++i) {
|
|
42
38
|
const readRequest = noteHashReadRequests.array[i];
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
.
|
|
46
|
-
?.find(n => isValidNoteHashReadRequest(readRequest, n.noteHash));
|
|
47
|
-
|
|
48
|
-
if (pendingNoteHash !== undefined) {
|
|
49
|
-
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
50
|
-
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNoteHash.index));
|
|
51
|
-
} else if (
|
|
52
|
-
!futureNoteHashMap
|
|
53
|
-
.get(readRequest)
|
|
54
|
-
.find(futureNoteHash => isValidNoteHashReadRequest(readRequest, futureNoteHash))
|
|
55
|
-
) {
|
|
40
|
+
if (readRequest.contractAddress.isZero()) {
|
|
41
|
+
// Settled read: empty contract address means resolve against the note hash tree.
|
|
56
42
|
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_SETTLED;
|
|
43
|
+
} else {
|
|
44
|
+
// Pending read: non-empty contract address means match against a pending note hash.
|
|
45
|
+
const pendingNoteHash = noteHashMap
|
|
46
|
+
.get(readRequest.value.toBigInt())
|
|
47
|
+
?.find(n => isValidNoteHashReadRequest(readRequest, n.noteHash));
|
|
48
|
+
|
|
49
|
+
if (pendingNoteHash) {
|
|
50
|
+
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
51
|
+
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNoteHash.index));
|
|
52
|
+
}
|
|
53
|
+
// Otherwise, the read request may be resolved by a future note hash. Leave as NOOP.
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
|
|
@@ -115,11 +112,10 @@ export async function buildNoteHashReadRequestHints<PENDING extends number, SETT
|
|
|
115
112
|
},
|
|
116
113
|
noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>,
|
|
117
114
|
noteHashes: ClaimedLengthArray<ScopedNoteHash, typeof MAX_NOTE_HASHES_PER_TX>,
|
|
118
|
-
futureNoteHashes: ScopedNoteHash[],
|
|
119
115
|
maxPending: PENDING = MAX_NOTE_HASH_READ_REQUESTS_PER_TX as PENDING,
|
|
120
116
|
maxSettled: SETTLED = MAX_NOTE_HASH_READ_REQUESTS_PER_TX as SETTLED,
|
|
121
117
|
) {
|
|
122
|
-
const resetActions = getNoteHashReadRequestResetActions(noteHashReadRequests, noteHashes
|
|
118
|
+
const resetActions = getNoteHashReadRequestResetActions(noteHashReadRequests, noteHashes);
|
|
123
119
|
return await buildNoteHashReadRequestHintsFromResetActions(
|
|
124
120
|
oracle,
|
|
125
121
|
noteHashReadRequests,
|
|
@@ -12,7 +12,6 @@ import type { ScopedNullifier } from '../nullifier.js';
|
|
|
12
12
|
import { NullifierReadRequestHintsBuilder } from './nullifier_read_request_hints.js';
|
|
13
13
|
import { ScopedReadRequest } from './read_request.js';
|
|
14
14
|
import { PendingReadHint, ReadRequestActionEnum, ReadRequestResetActions } from './read_request_hints.js';
|
|
15
|
-
import { ScopedValueCache } from './scoped_value_cache.js';
|
|
16
15
|
|
|
17
16
|
export function isValidNullifierReadRequest(readRequest: ScopedReadRequest, nullifier: ScopedNullifier) {
|
|
18
17
|
return (
|
|
@@ -30,7 +29,6 @@ interface NullifierMembershipWitnessWithPreimage {
|
|
|
30
29
|
export function getNullifierReadRequestResetActions(
|
|
31
30
|
nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
|
|
32
31
|
nullifiers: ClaimedLengthArray<ScopedNullifier, typeof MAX_NULLIFIERS_PER_TX>,
|
|
33
|
-
futureNullifiers: ScopedNullifier[],
|
|
34
32
|
): ReadRequestResetActions<typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX> {
|
|
35
33
|
const resetActions = ReadRequestResetActions.empty(MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
36
34
|
|
|
@@ -42,23 +40,23 @@ export function getNullifierReadRequestResetActions(
|
|
|
42
40
|
nullifierMap.set(value, arr);
|
|
43
41
|
});
|
|
44
42
|
|
|
45
|
-
const futureNullifiersMap = new ScopedValueCache(futureNullifiers);
|
|
46
|
-
|
|
47
43
|
for (let i = 0; i < nullifierReadRequests.claimedLength; ++i) {
|
|
48
44
|
const readRequest = nullifierReadRequests.array[i];
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (pendingNullifier !== undefined) {
|
|
54
|
-
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
55
|
-
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNullifier.index));
|
|
56
|
-
} else if (
|
|
57
|
-
!futureNullifiersMap
|
|
58
|
-
.get(readRequest)
|
|
59
|
-
.some(futureNullifier => isValidNullifierReadRequest(readRequest, futureNullifier))
|
|
60
|
-
) {
|
|
45
|
+
|
|
46
|
+
if (readRequest.contractAddress.isZero()) {
|
|
47
|
+
// Settled read: empty contract address means resolve against the nullifier tree.
|
|
61
48
|
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_SETTLED;
|
|
49
|
+
} else {
|
|
50
|
+
// Pending read: non-empty contract address means match against a pending nullifier.
|
|
51
|
+
const pendingNullifier = nullifierMap
|
|
52
|
+
.get(readRequest.value.toBigInt())
|
|
53
|
+
?.find(({ nullifier }) => isValidNullifierReadRequest(readRequest, nullifier));
|
|
54
|
+
|
|
55
|
+
if (pendingNullifier) {
|
|
56
|
+
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
57
|
+
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNullifier.index));
|
|
58
|
+
}
|
|
59
|
+
// Otherwise, the read request may be resolved by a future nullifier. Leave as NOOP.
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
|
|
@@ -111,11 +109,10 @@ export async function buildNullifierReadRequestHints<PENDING extends number, SET
|
|
|
111
109
|
},
|
|
112
110
|
nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
|
|
113
111
|
nullifiers: ClaimedLengthArray<ScopedNullifier, typeof MAX_NULLIFIERS_PER_TX>,
|
|
114
|
-
futureNullifiers: ScopedNullifier[],
|
|
115
112
|
maxPending: PENDING = MAX_NULLIFIER_READ_REQUESTS_PER_TX as PENDING,
|
|
116
113
|
maxSettled: SETTLED = MAX_NULLIFIER_READ_REQUESTS_PER_TX as SETTLED,
|
|
117
114
|
) {
|
|
118
|
-
const resetActions = getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers
|
|
115
|
+
const resetActions = getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers);
|
|
119
116
|
return await buildNullifierReadRequestHintsFromResetActions(
|
|
120
117
|
oracle,
|
|
121
118
|
nullifierReadRequests,
|
|
@@ -4,6 +4,7 @@ import type { Tuple } from '@aztec/foundation/serialize';
|
|
|
4
4
|
import type { ClaimedLengthArray } from '../claimed_length_array.js';
|
|
5
5
|
import type { ScopedNoteHash } from '../note_hash.js';
|
|
6
6
|
import type { ScopedNullifier } from '../nullifier.js';
|
|
7
|
+
import type { PrivateLogData, ScopedPrivateLogData } from '../private_log_data.js';
|
|
7
8
|
import { isValidNoteHashReadRequest } from './build_note_hash_read_request_hints.js';
|
|
8
9
|
import { isValidNullifierReadRequest } from './build_nullifier_read_request_hints.js';
|
|
9
10
|
import type { ScopedReadRequest } from './read_request.js';
|
|
@@ -15,11 +16,13 @@ export function buildTransientDataHints<NOTE_HASHES_LEN extends number, NULLIFIE
|
|
|
15
16
|
nullifiers: ClaimedLengthArray<ScopedNullifier, NULLIFIERS_LEN>,
|
|
16
17
|
futureNoteHashReads: ScopedReadRequest[],
|
|
17
18
|
futureNullifierReads: ScopedReadRequest[],
|
|
19
|
+
futureLogs: PrivateLogData[],
|
|
18
20
|
noteHashNullifierCounterMap: Map<number, number>,
|
|
19
21
|
splitCounter: number,
|
|
20
22
|
): { numTransientData: number; hints: Tuple<TransientDataSquashingHint, NULLIFIERS_LEN> } {
|
|
21
23
|
const futureNoteHashReadsMap = new ScopedValueCache(futureNoteHashReads);
|
|
22
24
|
const futureNullifierReadsMap = new ScopedValueCache(futureNullifierReads);
|
|
25
|
+
const futureLogNoteHashCounters = new Set(futureLogs.filter(l => l.noteHashCounter > 0).map(l => l.noteHashCounter));
|
|
23
26
|
|
|
24
27
|
const nullifierIndexMap: Map<number, number> = new Map();
|
|
25
28
|
nullifiers.getActiveItems().forEach((n, i) => nullifierIndexMap.set(n.counter, i));
|
|
@@ -28,10 +31,12 @@ export function buildTransientDataHints<NOTE_HASHES_LEN extends number, NULLIFIE
|
|
|
28
31
|
for (let noteHashIndex = 0; noteHashIndex < noteHashes.claimedLength; noteHashIndex++) {
|
|
29
32
|
const noteHash = noteHashes.array[noteHashIndex];
|
|
30
33
|
const noteHashNullifierCounter = noteHashNullifierCounterMap.get(noteHash.counter);
|
|
31
|
-
// The note hash might not be linked to a nullifier or it might be read in the future
|
|
34
|
+
// The note hash might not be linked to a nullifier, or it might be read in the future, or a future log might be
|
|
35
|
+
// linked to it.
|
|
32
36
|
if (
|
|
33
37
|
!noteHashNullifierCounter ||
|
|
34
|
-
futureNoteHashReadsMap.get(noteHash).find(read => isValidNoteHashReadRequest(read, noteHash))
|
|
38
|
+
futureNoteHashReadsMap.get(noteHash).find(read => isValidNoteHashReadRequest(read, noteHash)) ||
|
|
39
|
+
futureLogNoteHashCounters.has(noteHash.counter)
|
|
35
40
|
) {
|
|
36
41
|
continue;
|
|
37
42
|
}
|
|
@@ -77,3 +82,13 @@ export function buildTransientDataHints<NOTE_HASHES_LEN extends number, NULLIFIE
|
|
|
77
82
|
hints: padArrayEnd(hints, noActionHint, nullifiers.array.length as NULLIFIERS_LEN),
|
|
78
83
|
};
|
|
79
84
|
}
|
|
85
|
+
|
|
86
|
+
/** Counts private logs that are linked to squashed note hashes and would be removed along with them. */
|
|
87
|
+
export function countSquashedLogs<NOTE_HASHES_LEN extends number, LOGS_LEN extends number>(
|
|
88
|
+
noteHashes: ClaimedLengthArray<ScopedNoteHash, NOTE_HASHES_LEN>,
|
|
89
|
+
privateLogs: ClaimedLengthArray<ScopedPrivateLogData, LOGS_LEN>,
|
|
90
|
+
squashingHints: TransientDataSquashingHint[],
|
|
91
|
+
): number {
|
|
92
|
+
const squashedNoteHashCounters = new Set(squashingHints.map(h => noteHashes.array[h.noteHashIndex].counter));
|
|
93
|
+
return privateLogs.getActiveItems().filter(l => squashedNoteHashCounters.has(l.inner.noteHashCounter)).length;
|
|
94
|
+
}
|
|
@@ -234,6 +234,15 @@ export class PrivateKernelTailCircuitPublicInputs {
|
|
|
234
234
|
return noteHashes.filter(n => !n.isZero());
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
getNonEmptyL2ToL1Msgs() {
|
|
238
|
+
const l2ToL1Msgs = this.forPublic
|
|
239
|
+
? this.forPublic.nonRevertibleAccumulatedData.l2ToL1Msgs.concat(
|
|
240
|
+
this.forPublic.revertibleAccumulatedData.l2ToL1Msgs,
|
|
241
|
+
)
|
|
242
|
+
: this.forRollup!.end.l2ToL1Msgs;
|
|
243
|
+
return l2ToL1Msgs.filter(m => !m.isEmpty());
|
|
244
|
+
}
|
|
245
|
+
|
|
237
246
|
getNonEmptyNullifiers() {
|
|
238
247
|
const nullifiers = this.forPublic
|
|
239
248
|
? this.forPublic.nonRevertibleAccumulatedData.nullifiers.concat(
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
|
|
2
|
+
import { type ConfigMappingsType, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
|
|
3
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
|
|
5
|
+
export type DataStoreConfig = {
|
|
6
|
+
dataDirectory?: string;
|
|
7
|
+
dataStoreMapSizeKb: number;
|
|
8
|
+
l1Contracts?: { rollupAddress: EthAddress };
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const dataConfigMappings: ConfigMappingsType<DataStoreConfig> = {
|
|
12
|
+
dataDirectory: {
|
|
13
|
+
env: 'DATA_DIRECTORY',
|
|
14
|
+
description: 'Optional dir to store data. If omitted will store in memory.',
|
|
15
|
+
},
|
|
16
|
+
dataStoreMapSizeKb: {
|
|
17
|
+
env: 'DATA_STORE_MAP_SIZE_KB',
|
|
18
|
+
description: 'The maximum possible size of a data store DB in KB. Can be overridden by component-specific options.',
|
|
19
|
+
...numberConfigHelper(128 * 1_024 * 1_024), // Defaulted to 128 GB
|
|
20
|
+
},
|
|
21
|
+
l1Contracts: {
|
|
22
|
+
description: 'The deployed L1 contract addresses',
|
|
23
|
+
nested: {
|
|
24
|
+
rollupAddress: l1ContractAddressesMapping.rollupAddress,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns the archiver configuration from the environment variables.
|
|
31
|
+
* Note: If an environment variable is not set, the default value is used.
|
|
32
|
+
* @returns The archiver configuration.
|
|
33
|
+
*/
|
|
34
|
+
export function getDataConfigFromEnv(): DataStoreConfig {
|
|
35
|
+
return getConfigFromMappings<DataStoreConfig>(dataConfigMappings);
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './config.js';
|