@aztec/stdlib 0.0.1-commit.358457c → 0.0.1-commit.3895657bc

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.
Files changed (195) hide show
  1. package/dest/abi/decoder.d.ts +2 -2
  2. package/dest/abi/decoder.d.ts.map +1 -1
  3. package/dest/abi/decoder.js +7 -5
  4. package/dest/abi/encoder.d.ts +1 -1
  5. package/dest/abi/encoder.d.ts.map +1 -1
  6. package/dest/abi/encoder.js +37 -6
  7. package/dest/abi/event_metadata_definition.d.ts +3 -1
  8. package/dest/abi/event_metadata_definition.d.ts.map +1 -1
  9. package/dest/abi/event_metadata_definition.js +1 -1
  10. package/dest/abi/utils.d.ts +14 -1
  11. package/dest/abi/utils.d.ts.map +1 -1
  12. package/dest/abi/utils.js +15 -0
  13. package/dest/avm/avm.d.ts +300 -300
  14. package/dest/avm/avm_proving_request.d.ts +166 -166
  15. package/dest/avm/revert_code.d.ts +16 -1
  16. package/dest/avm/revert_code.d.ts.map +1 -1
  17. package/dest/avm/revert_code.js +15 -5
  18. package/dest/block/l2_block.d.ts +9 -1
  19. package/dest/block/l2_block.d.ts.map +1 -1
  20. package/dest/block/l2_block.js +12 -2
  21. package/dest/block/l2_block_source.d.ts +6 -1
  22. package/dest/block/l2_block_source.d.ts.map +1 -1
  23. package/dest/block/l2_block_stream/l2_block_stream.d.ts +1 -1
  24. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  25. package/dest/block/l2_block_stream/l2_block_stream.js +10 -0
  26. package/dest/checkpoint/checkpoint.d.ts +2 -1
  27. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  28. package/dest/checkpoint/checkpoint.js +9 -4
  29. package/dest/checkpoint/index.d.ts +2 -1
  30. package/dest/checkpoint/index.d.ts.map +1 -1
  31. package/dest/checkpoint/index.js +1 -0
  32. package/dest/checkpoint/validate.d.ts +36 -0
  33. package/dest/checkpoint/validate.d.ts.map +1 -0
  34. package/dest/checkpoint/validate.js +120 -0
  35. package/dest/config/sequencer-config.d.ts +4 -2
  36. package/dest/config/sequencer-config.d.ts.map +1 -1
  37. package/dest/config/sequencer-config.js +6 -0
  38. package/dest/gas/gas_fees.d.ts +1 -1
  39. package/dest/gas/gas_fees.d.ts.map +1 -1
  40. package/dest/gas/gas_fees.js +4 -1
  41. package/dest/ha-signing/config.d.ts +49 -14
  42. package/dest/ha-signing/config.d.ts.map +1 -1
  43. package/dest/ha-signing/config.js +20 -15
  44. package/dest/ha-signing/index.d.ts +3 -2
  45. package/dest/ha-signing/index.d.ts.map +1 -1
  46. package/dest/ha-signing/index.js +2 -1
  47. package/dest/ha-signing/local_config.d.ts +63 -0
  48. package/dest/ha-signing/local_config.d.ts.map +1 -0
  49. package/dest/ha-signing/local_config.js +24 -0
  50. package/dest/interfaces/allowed_element.d.ts +26 -20
  51. package/dest/interfaces/allowed_element.d.ts.map +1 -1
  52. package/dest/interfaces/allowed_element.js +8 -8
  53. package/dest/interfaces/archiver.d.ts +1 -1
  54. package/dest/interfaces/archiver.d.ts.map +1 -1
  55. package/dest/interfaces/archiver.js +1 -0
  56. package/dest/interfaces/aztec-node-admin.d.ts +70 -30
  57. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  58. package/dest/interfaces/aztec-node.d.ts +10 -5
  59. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  60. package/dest/interfaces/aztec-node.js +3 -2
  61. package/dest/interfaces/block-builder.d.ts +11 -5
  62. package/dest/interfaces/block-builder.d.ts.map +1 -1
  63. package/dest/interfaces/block-builder.js +7 -2
  64. package/dest/interfaces/configs.d.ts +57 -32
  65. package/dest/interfaces/configs.d.ts.map +1 -1
  66. package/dest/interfaces/configs.js +5 -2
  67. package/dest/interfaces/p2p.d.ts +3 -8
  68. package/dest/interfaces/p2p.d.ts.map +1 -1
  69. package/dest/interfaces/validator.d.ts +103 -41
  70. package/dest/interfaces/validator.d.ts.map +1 -1
  71. package/dest/interfaces/validator.js +8 -4
  72. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
  73. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
  74. package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
  75. package/dest/kv-store/config.d.ts +17 -0
  76. package/dest/kv-store/config.d.ts.map +1 -0
  77. package/dest/kv-store/config.js +26 -0
  78. package/dest/kv-store/index.d.ts +2 -0
  79. package/dest/kv-store/index.d.ts.map +1 -0
  80. package/dest/kv-store/index.js +1 -0
  81. package/dest/logs/extended_directional_app_tagging_secret.d.ts +47 -0
  82. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -0
  83. package/dest/logs/{directional_app_tagging_secret.js → extended_directional_app_tagging_secret.js} +23 -15
  84. package/dest/logs/index.d.ts +2 -2
  85. package/dest/logs/index.d.ts.map +1 -1
  86. package/dest/logs/index.js +1 -1
  87. package/dest/logs/pre_tag.d.ts +16 -11
  88. package/dest/logs/pre_tag.d.ts.map +1 -1
  89. package/dest/logs/pre_tag.js +2 -2
  90. package/dest/logs/public_log.d.ts +4 -3
  91. package/dest/logs/public_log.d.ts.map +1 -1
  92. package/dest/logs/public_log.js +2 -1
  93. package/dest/logs/siloed_tag.d.ts +5 -3
  94. package/dest/logs/siloed_tag.d.ts.map +1 -1
  95. package/dest/logs/siloed_tag.js +6 -1
  96. package/dest/logs/tag.js +1 -1
  97. package/dest/p2p/checkpoint_proposal.d.ts +1 -6
  98. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  99. package/dest/p2p/checkpoint_proposal.js +0 -12
  100. package/dest/p2p/client_type.d.ts +2 -5
  101. package/dest/p2p/client_type.d.ts.map +1 -1
  102. package/dest/p2p/client_type.js +0 -7
  103. package/dest/p2p/index.d.ts +1 -2
  104. package/dest/p2p/index.d.ts.map +1 -1
  105. package/dest/p2p/index.js +0 -1
  106. package/dest/p2p/peer_error.d.ts +3 -1
  107. package/dest/p2p/peer_error.d.ts.map +1 -1
  108. package/dest/p2p/peer_error.js +5 -0
  109. package/dest/p2p/topic_type.d.ts +3 -4
  110. package/dest/p2p/topic_type.d.ts.map +1 -1
  111. package/dest/p2p/topic_type.js +7 -24
  112. package/dest/slashing/tally.d.ts +7 -2
  113. package/dest/slashing/tally.d.ts.map +1 -1
  114. package/dest/slashing/tally.js +30 -2
  115. package/dest/tests/factories.d.ts +3 -1
  116. package/dest/tests/factories.d.ts.map +1 -1
  117. package/dest/tests/factories.js +8 -0
  118. package/dest/tests/mocks.d.ts +4 -2
  119. package/dest/tests/mocks.d.ts.map +1 -1
  120. package/dest/tests/mocks.js +13 -8
  121. package/dest/tx/block_header.d.ts +3 -1
  122. package/dest/tx/block_header.d.ts.map +1 -1
  123. package/dest/tx/block_header.js +4 -0
  124. package/dest/tx/simulated_tx.d.ts +5 -2
  125. package/dest/tx/simulated_tx.d.ts.map +1 -1
  126. package/dest/tx/simulated_tx.js +4 -1
  127. package/dest/tx/tx.d.ts +6 -5
  128. package/dest/tx/tx.d.ts.map +1 -1
  129. package/dest/tx/tx.js +18 -6
  130. package/dest/tx/validator/error_texts.d.ts +5 -1
  131. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  132. package/dest/tx/validator/error_texts.js +4 -0
  133. package/dest/update-checker/index.d.ts +3 -2
  134. package/dest/update-checker/index.d.ts.map +1 -1
  135. package/dest/update-checker/index.js +2 -1
  136. package/dest/update-checker/package_version.d.ts +3 -0
  137. package/dest/update-checker/package_version.d.ts.map +1 -0
  138. package/dest/update-checker/package_version.js +11 -0
  139. package/dest/update-checker/version_checker.d.ts +25 -0
  140. package/dest/update-checker/version_checker.d.ts.map +1 -0
  141. package/dest/update-checker/version_checker.js +50 -0
  142. package/package.json +11 -10
  143. package/src/abi/decoder.ts +15 -6
  144. package/src/abi/encoder.ts +49 -6
  145. package/src/abi/event_metadata_definition.ts +2 -0
  146. package/src/abi/utils.ts +25 -0
  147. package/src/avm/revert_code.ts +15 -0
  148. package/src/block/l2_block.ts +13 -1
  149. package/src/block/l2_block_source.ts +6 -0
  150. package/src/block/l2_block_stream/l2_block_stream.ts +21 -0
  151. package/src/checkpoint/checkpoint.ts +12 -3
  152. package/src/checkpoint/index.ts +1 -0
  153. package/src/checkpoint/validate.ts +230 -0
  154. package/src/config/sequencer-config.ts +9 -1
  155. package/src/gas/gas_fees.ts +7 -1
  156. package/src/ha-signing/config.ts +45 -38
  157. package/src/ha-signing/index.ts +9 -0
  158. package/src/ha-signing/local_config.ts +46 -0
  159. package/src/interfaces/allowed_element.ts +29 -9
  160. package/src/interfaces/archiver.ts +1 -0
  161. package/src/interfaces/aztec-node.ts +14 -4
  162. package/src/interfaces/block-builder.ts +25 -5
  163. package/src/interfaces/configs.ts +22 -8
  164. package/src/interfaces/p2p.ts +2 -13
  165. package/src/interfaces/validator.ts +50 -28
  166. package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
  167. package/src/kv-store/config.ts +36 -0
  168. package/src/kv-store/index.ts +1 -0
  169. package/src/logs/{directional_app_tagging_secret.ts → extended_directional_app_tagging_secret.ts} +24 -16
  170. package/src/logs/index.ts +1 -1
  171. package/src/logs/pre_tag.ts +5 -5
  172. package/src/logs/public_log.ts +4 -2
  173. package/src/logs/siloed_tag.ts +8 -2
  174. package/src/logs/tag.ts +1 -1
  175. package/src/p2p/checkpoint_proposal.ts +0 -17
  176. package/src/p2p/client_type.ts +0 -6
  177. package/src/p2p/index.ts +0 -1
  178. package/src/p2p/peer_error.ts +7 -0
  179. package/src/p2p/topic_type.ts +8 -15
  180. package/src/slashing/tally.ts +34 -1
  181. package/src/tests/factories.ts +9 -0
  182. package/src/tests/mocks.ts +18 -7
  183. package/src/tx/block_header.ts +6 -0
  184. package/src/tx/simulated_tx.ts +8 -1
  185. package/src/tx/tx.ts +20 -11
  186. package/src/tx/validator/error_texts.ts +4 -0
  187. package/src/update-checker/index.ts +2 -1
  188. package/src/update-checker/package_version.ts +17 -0
  189. package/src/update-checker/version_checker.ts +65 -0
  190. package/dest/logs/directional_app_tagging_secret.d.ts +0 -40
  191. package/dest/logs/directional_app_tagging_secret.d.ts.map +0 -1
  192. package/dest/update-checker/update-checker.d.ts +0 -49
  193. package/dest/update-checker/update-checker.d.ts.map +0 -1
  194. package/dest/update-checker/update-checker.js +0 -130
  195. package/src/update-checker/update-checker.ts +0 -166
@@ -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
- /** The list of functions calls allowed to run in setup */
35
- txPublicSetupAllowList?: AllowedElement[];
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
- txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
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
- | 'txPublicSetupAllowList'
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>
@@ -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 P2PApiWithoutAttestations {
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 P2PApiWithAttestations {
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()
@@ -20,49 +20,67 @@ import type { PeerId } from '@libp2p/interface';
20
20
  import { z } from 'zod';
21
21
 
22
22
  import type { CommitteeAttestationsAndSigners } from '../block/index.js';
23
- import { type ValidatorHASignerConfig, ValidatorHASignerConfigSchema } from '../ha-signing/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
- /** The private keys of the validators participating in attestation duties */
31
- validatorPrivateKeys?: SecretValue<`0x${string}`[]>;
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
- /** The addresses of the validators to use with remote signers */
34
- validatorAddresses?: EthAddress[];
39
+ /** The addresses of the validators to use with remote signers */
40
+ validatorAddresses?: EthAddress[];
35
41
 
36
- /** Do not run the validator */
37
- disableValidator: boolean;
42
+ /** Do not run the validator */
43
+ disableValidator: boolean;
38
44
 
39
- /** Temporarily disable these specific validator addresses */
40
- disabledValidators: EthAddress[];
45
+ /** Temporarily disable these specific validator addresses */
46
+ disabledValidators: EthAddress[];
41
47
 
42
- /** Interval between polling for new attestations from peers */
43
- attestationPollingIntervalMs: number;
48
+ /** Interval between polling for new attestations from peers */
49
+ attestationPollingIntervalMs: number;
44
50
 
45
- /** Whether to re-execute transactions in a block proposal before attesting */
46
- validatorReexecute: boolean;
51
+ /** Whether to re-execute transactions in a block proposal before attesting */
52
+ validatorReexecute: boolean;
47
53
 
48
- /** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
49
- alwaysReexecuteBlockProposals?: boolean;
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
- /** Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus */
52
- fishermanMode?: boolean;
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
- /** Skip checkpoint proposal validation and always attest (default: false) */
55
- skipCheckpointProposalValidation?: boolean;
60
+ /** Skip checkpoint proposal validation and always attest (default: false) */
61
+ skipCheckpointProposalValidation?: boolean;
56
62
 
57
- /** Skip pushing re-executed blocks to archiver (default: false) */
58
- skipPushProposedBlocksToArchiver?: boolean;
63
+ /** Skip pushing re-executed blocks to archiver (default: false) */
64
+ skipPushProposedBlocksToArchiver?: boolean;
59
65
 
60
- /** Agree to attest to equivocated checkpoint proposals (for testing purposes only) */
61
- attestToEquivocatedProposals?: boolean;
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, 'txPublicSetupAllowList' | 'broadcastInvalidBlockProposal'> &
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
- txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
116
+ txPublicSetupAllowListExtend: z.array(AllowedElementSchema).optional(),
95
117
  broadcastInvalidBlockProposal: z.boolean().optional(),
96
118
  slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
97
119
  slashDuplicateProposalPenalty: schemas.BigInt,
@@ -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';
@@ -5,22 +5,28 @@ import type { Point } from '@aztec/foundation/curves/grumpkin';
5
5
 
6
6
  import { z } from 'zod';
7
7
 
8
- import type { AztecAddress } from '../aztec-address/index.js';
8
+ import { AztecAddress } from '../aztec-address/index.js';
9
9
  import type { CompleteAddress } from '../contract/complete_address.js';
10
10
  import { computeAddressSecret, computePreaddress } from '../keys/derivation.js';
11
11
 
12
12
  /**
13
- * Directional application tagging secret used for log tagging.
13
+ * Extended directional application tagging secret used for log tagging.
14
14
  *
15
- * "Directional" because the derived secret is bound to the recipient
16
- * address: A→B differs from B→A even with the same participants and app.
15
+ * "Extended" because it bundles the directional app tagging secret with the app (contract) address. This bundling was
16
+ * done because where this type is used we commonly need access to both the secret and the address.
17
17
  *
18
- * Note: It's a bit unfortunate that this type resides in `stdlib` as the rest of the tagging functionality resides
19
- * in `pxe/src/tagging`. We need to use this type in `PreTag` that in turn is used by other types
20
- * in stdlib hence there doesn't seem to be a good way around this.
18
+ * "Directional" because the derived secret is bound to the recipient address: A→B differs from B→A even with the same
19
+ * participants and app.
20
+ *
21
+ * Note: It's a bit unfortunate that this type resides in `stdlib` as the rest of the tagging functionality resides in
22
+ * `pxe/src/tagging`. We need to use this type in `PreTag` that in turn is used by other types in stdlib hence there
23
+ * doesn't seem to be a good way around this.
21
24
  */
22
- export class DirectionalAppTaggingSecret {
23
- private constructor(public readonly value: Fr) {}
25
+ export class ExtendedDirectionalAppTaggingSecret {
26
+ private constructor(
27
+ public readonly secret: Fr,
28
+ public readonly app: AztecAddress,
29
+ ) {}
24
30
 
25
31
  /**
26
32
  * Derives shared tagging secret and from that, the app address and recipient derives the directional app tagging
@@ -39,20 +45,21 @@ export class DirectionalAppTaggingSecret {
39
45
  externalAddress: AztecAddress,
40
46
  app: AztecAddress,
41
47
  recipient: AztecAddress,
42
- ): Promise<DirectionalAppTaggingSecret> {
48
+ ): Promise<ExtendedDirectionalAppTaggingSecret> {
43
49
  const taggingSecretPoint = await computeSharedTaggingSecret(localAddress, localIvsk, externalAddress);
44
50
  const appTaggingSecret = await poseidon2Hash([taggingSecretPoint.x, taggingSecretPoint.y, app]);
45
51
  const directionalAppTaggingSecret = await poseidon2Hash([appTaggingSecret, recipient]);
46
52
 
47
- return new DirectionalAppTaggingSecret(directionalAppTaggingSecret);
53
+ return new ExtendedDirectionalAppTaggingSecret(directionalAppTaggingSecret, app);
48
54
  }
49
55
 
50
56
  toString(): string {
51
- return this.value.toString();
57
+ return `${this.secret.toString()}:${this.app.toString()}`;
52
58
  }
53
59
 
54
- static fromString(str: string): DirectionalAppTaggingSecret {
55
- return new DirectionalAppTaggingSecret(Fr.fromString(str));
60
+ static fromString(str: string): ExtendedDirectionalAppTaggingSecret {
61
+ const [secretStr, appStr] = str.split(':');
62
+ return new ExtendedDirectionalAppTaggingSecret(Fr.fromString(secretStr), AztecAddress.fromString(appStr));
56
63
  }
57
64
  }
58
65
 
@@ -74,6 +81,7 @@ async function computeSharedTaggingSecret(
74
81
  return Grumpkin.mul(externalAddressPoint, await computeAddressSecret(knownPreaddress, localIvsk));
75
82
  }
76
83
 
77
- export const DirectionalAppTaggingSecretSchema = z.object({
78
- value: Fr.schema,
84
+ export const ExtendedDirectionalAppTaggingSecretSchema = z.object({
85
+ secret: Fr.schema,
86
+ app: AztecAddress.schema,
79
87
  });
package/src/logs/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './directional_app_tagging_secret.js';
1
+ export * from './extended_directional_app_tagging_secret.js';
2
2
  export * from './pre_tag.js';
3
3
  export * from './contract_class_log.js';
4
4
  export * from './public_log.js';
@@ -3,9 +3,9 @@ import { schemas } from '@aztec/foundation/schemas';
3
3
  import { z } from 'zod';
4
4
 
5
5
  import {
6
- type DirectionalAppTaggingSecret,
7
- DirectionalAppTaggingSecretSchema,
8
- } from './directional_app_tagging_secret.js';
6
+ type ExtendedDirectionalAppTaggingSecret,
7
+ ExtendedDirectionalAppTaggingSecretSchema,
8
+ } from './extended_directional_app_tagging_secret.js';
9
9
 
10
10
  /**
11
11
  * Represents a preimage of a private log tag (see `Tag` in `pxe/src/tagging`).
@@ -15,11 +15,11 @@ import {
15
15
  * around this.
16
16
  */
17
17
  export type PreTag = {
18
- secret: DirectionalAppTaggingSecret;
18
+ extendedSecret: ExtendedDirectionalAppTaggingSecret;
19
19
  index: number;
20
20
  };
21
21
 
22
22
  export const PreTagSchema = z.object({
23
- secret: DirectionalAppTaggingSecretSchema,
23
+ extendedSecret: ExtendedDirectionalAppTaggingSecretSchema,
24
24
  index: schemas.Integer,
25
25
  });
@@ -120,8 +120,8 @@ export class FlatPublicLogs {
120
120
 
121
121
  export class PublicLog {
122
122
  constructor(
123
- public contractAddress: AztecAddress,
124
- public fields: Fr[],
123
+ public readonly contractAddress: AztecAddress,
124
+ public readonly fields: Fr[],
125
125
  ) {}
126
126
 
127
127
  static from(fields: FieldsOf<PublicLog>) {
@@ -146,7 +146,9 @@ export class PublicLog {
146
146
  return this.fields.length + PUBLIC_LOG_HEADER_LENGTH;
147
147
  }
148
148
 
149
+ /** Returns the serialized log (field as in noir field and not a struct field). */
149
150
  getEmittedFields() {
151
+ // We slice from 0 to return a shallow copy.
150
152
  return this.fields.slice(0);
151
153
  }
152
154
 
@@ -4,7 +4,8 @@ import type { ZodFor } from '@aztec/foundation/schemas';
4
4
  import type { AztecAddress } from '../aztec-address/index.js';
5
5
  import { computeSiloedPrivateLogFirstField } from '../hash/hash.js';
6
6
  import { schemas } from '../schemas/schemas.js';
7
- import type { Tag } from './tag.js';
7
+ import type { PreTag } from './pre_tag.js';
8
+ import { Tag } from './tag.js';
8
9
 
9
10
  /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
10
11
 
@@ -21,7 +22,12 @@ export interface SiloedTag {
21
22
  export class SiloedTag {
22
23
  constructor(public readonly value: Fr) {}
23
24
 
24
- static async compute(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
25
+ static async compute(preTag: PreTag): Promise<SiloedTag> {
26
+ const tag = await Tag.compute(preTag);
27
+ return SiloedTag.computeFromTagAndApp(tag, preTag.extendedSecret.app);
28
+ }
29
+
30
+ static async computeFromTagAndApp(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
25
31
  const siloedTag = await computeSiloedPrivateLogFirstField(app, tag.value);
26
32
  return new SiloedTag(siloedTag);
27
33
  }
package/src/logs/tag.ts CHANGED
@@ -20,7 +20,7 @@ export class Tag {
20
20
  constructor(public readonly value: Fr) {}
21
21
 
22
22
  static async compute(preTag: PreTag): Promise<Tag> {
23
- const tag = await poseidon2Hash([preTag.secret.value, preTag.index]);
23
+ const tag = await poseidon2Hash([preTag.extendedSecret.secret, preTag.index]);
24
24
  return new Tag(tag);
25
25
  }
26
26
 
@@ -101,23 +101,6 @@ export class CheckpointProposal extends Gossipable {
101
101
  return this.checkpointHeader.slotNumber;
102
102
  }
103
103
 
104
- get blockNumber(): BlockNumber {
105
- if (!this.lastBlock) {
106
- throw new Error('Cannot get blockNumber without lastBlock');
107
- }
108
- return this.lastBlock.blockHeader.getBlockNumber();
109
- }
110
-
111
- /** Convenience getter for txHashes from lastBlock */
112
- get txHashes(): TxHash[] {
113
- return this.lastBlock?.txHashes ?? [];
114
- }
115
-
116
- /** Convenience getter for txs from lastBlock */
117
- get txs(): Tx[] | undefined {
118
- return this.lastBlock?.signedTxs?.txs;
119
- }
120
-
121
104
  /**
122
105
  * Extract a BlockProposal from the last block info.
123
106
  * Uses inHash from checkpointHeader.contentCommitment.inHash
@@ -1,6 +0,0 @@
1
- export enum P2PClientType {
2
- // Full p2p clients will subscribe to all gossip topics
3
- Full,
4
- // Prove p2p clients will only subscribe to transaction and proving topics
5
- Prover,
6
- }
package/src/p2p/index.ts CHANGED
@@ -8,7 +8,6 @@ export * from './interface.js';
8
8
  export * from './signature_utils.js';
9
9
  export * from './signed_txs.js';
10
10
  export * from './topic_type.js';
11
- export * from './client_type.js';
12
11
  export * from './message_validator.js';
13
12
  export * from './peer_error.js';
14
13
  export * from './constants.js';
@@ -15,3 +15,10 @@ export enum PeerErrorSeverity {
15
15
  */
16
16
  HighToleranceError = 'HighToleranceError',
17
17
  }
18
+
19
+ /** Severities ordered from mildest to harshest. */
20
+ export const PeerErrorSeverityByHarshness = [
21
+ PeerErrorSeverity.HighToleranceError,
22
+ PeerErrorSeverity.MidToleranceError,
23
+ PeerErrorSeverity.LowToleranceError,
24
+ ] as const;
@@ -1,5 +1,3 @@
1
- import { P2PClientType } from './client_type.js';
2
-
3
1
  /**
4
2
  * Creates the topic channel identifier string from a given topic type
5
3
  */
@@ -27,19 +25,14 @@ export enum TopicType {
27
25
  checkpoint_attestation = 'checkpoint_attestation',
28
26
  }
29
27
 
30
- export function getTopicTypeForClientType(clientType: P2PClientType) {
31
- if (clientType === P2PClientType.Full) {
32
- return [TopicType.tx, TopicType.block_proposal, TopicType.checkpoint_proposal, TopicType.checkpoint_attestation];
33
- } else if (clientType === P2PClientType.Prover) {
34
- return [TopicType.tx, TopicType.block_proposal, TopicType.checkpoint_proposal];
35
- } else {
36
- const _: never = clientType;
37
- return [TopicType.tx];
38
- }
39
- }
40
-
41
- export function getTopicsForClientAndConfig(clientType: P2PClientType, disableTransactions: boolean) {
42
- const topics = getTopicTypeForClientType(clientType);
28
+ /** Returns all gossip topics, optionally filtering out transactions. */
29
+ export function getTopicsForConfig(disableTransactions: boolean) {
30
+ const topics = [
31
+ TopicType.tx,
32
+ TopicType.block_proposal,
33
+ TopicType.checkpoint_proposal,
34
+ TopicType.checkpoint_attestation,
35
+ ];
43
36
  if (disableTransactions) {
44
37
  return topics.filter(topic => topic !== TopicType.tx);
45
38
  }
@@ -1,6 +1,7 @@
1
1
  import { sumBigint } from '@aztec/foundation/bigint';
2
2
  import { padArrayEnd } from '@aztec/foundation/collection';
3
3
  import { EthAddress } from '@aztec/foundation/eth-address';
4
+ import { type Logger, createLogger } from '@aztec/foundation/log';
4
5
  import type { PartialBy } from '@aztec/foundation/types';
5
6
 
6
7
  import { getEpochForOffense } from './helpers.js';
@@ -12,6 +13,9 @@ import type { Offense, ValidatorSlashVote } from './types.js';
12
13
  * @param committees - Array of committees (each containing array of validator addresses)
13
14
  * @param epochsForCommittees - Array of epochs corresponding to each committee
14
15
  * @param settings - Settings including slashingAmounts and optional validator override lists
16
+ * @param settings.maxSlashedValidators - If set, limits the total number of [validator, epoch] pairs
17
+ * with non-zero votes. The lowest-vote pairs are zeroed out to stay within the limit.
18
+ * @param logger - Logger, logs which validators were dropped.
15
19
  * @returns Array of ValidatorSlashVote, where each vote is how many slash units the validator in that position should be slashed
16
20
  */
17
21
  export function getSlashConsensusVotesFromOffenses(
@@ -22,9 +26,11 @@ export function getSlashConsensusVotesFromOffenses(
22
26
  slashingAmounts: [bigint, bigint, bigint];
23
27
  epochDuration: number;
24
28
  targetCommitteeSize: number;
29
+ maxSlashedValidators?: number;
25
30
  },
31
+ logger: Logger = createLogger('slasher:tally'),
26
32
  ): ValidatorSlashVote[] {
27
- const { slashingAmounts, targetCommitteeSize } = settings;
33
+ const { slashingAmounts, targetCommitteeSize, maxSlashedValidators } = settings;
28
34
 
29
35
  if (committees.length !== epochsForCommittees.length) {
30
36
  throw new Error('committees and epochsForCommittees must have the same length');
@@ -53,6 +59,33 @@ export function getSlashConsensusVotesFromOffenses(
53
59
  return padArrayEnd(votes, 0, targetCommitteeSize);
54
60
  });
55
61
 
62
+ // if a cap is set, zero out the lowest-vote [validator, epoch] pairs so that the most severe slashes stay.
63
+ if (maxSlashedValidators === undefined) {
64
+ return votes;
65
+ }
66
+
67
+ const nonZeroByDescendingVote = [...votes.entries()].filter(([, vote]) => vote > 0).sort(([, a], [, b]) => b - a);
68
+
69
+ const toTruncate = nonZeroByDescendingVote.slice(maxSlashedValidators);
70
+ for (const [idx] of toTruncate) {
71
+ votes[idx] = 0;
72
+ }
73
+
74
+ if (toTruncate.length > 0) {
75
+ const truncated = toTruncate.map(([idx]) => {
76
+ const committeeIndex = Math.floor(idx / targetCommitteeSize);
77
+ const positionInCommittee = idx % targetCommitteeSize;
78
+ return {
79
+ validator: committees[committeeIndex][positionInCommittee].toString(),
80
+ epoch: epochsForCommittees[committeeIndex],
81
+ };
82
+ });
83
+ logger.warn(
84
+ `Truncated ${toTruncate.length} validator-epoch pairs to stay within limit of ${maxSlashedValidators}`,
85
+ { truncated },
86
+ );
87
+ }
88
+
56
89
  return votes;
57
90
  }
58
91
 
@@ -128,6 +128,7 @@ import {
128
128
  PublicCallRequestArrayLengths,
129
129
  } from '../kernel/public_call_request.js';
130
130
  import { PublicKeys, computeAddress } from '../keys/index.js';
131
+ import { ExtendedDirectionalAppTaggingSecret } from '../logs/extended_directional_app_tagging_secret.js';
131
132
  import { ContractClassLog, ContractClassLogFields } from '../logs/index.js';
132
133
  import { PrivateLog } from '../logs/private_log.js';
133
134
  import { FlatPublicLogs, PublicLog } from '../logs/public_log.js';
@@ -1757,3 +1758,11 @@ export function makeL2Tips(
1757
1758
  },
1758
1759
  };
1759
1760
  }
1761
+
1762
+ export async function randomExtendedDirectionalAppTaggingSecret(): Promise<ExtendedDirectionalAppTaggingSecret> {
1763
+ const resolvedApp = await AztecAddress.random();
1764
+ // Using the fromString method like this is messy as it leaks the underlying serialization format but I don't want to
1765
+ // expose the type's constructor just for tests since in prod the secret is always constructed via compute. Also this
1766
+ // method is tested in extended_directional_app_tagging_secret.test.ts hence all should be fine.
1767
+ return ExtendedDirectionalAppTaggingSecret.fromString(`${Fr.random().toString()}:${resolvedApp.toString()}`);
1768
+ }