@aztec/stdlib 0.0.1-commit.381b1a9 → 0.0.1-commit.3a4ae741b

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 (149) hide show
  1. package/dest/abi/abi.d.ts +138 -1
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +10 -2
  4. package/dest/abi/buffer.d.ts +14 -4
  5. package/dest/abi/buffer.d.ts.map +1 -1
  6. package/dest/abi/buffer.js +25 -4
  7. package/dest/avm/avm.d.ts +300 -300
  8. package/dest/block/l2_block_source.d.ts +5 -3
  9. package/dest/block/l2_block_source.d.ts.map +1 -1
  10. package/dest/checkpoint/validate.js +2 -2
  11. package/dest/config/index.d.ts +2 -1
  12. package/dest/config/index.d.ts.map +1 -1
  13. package/dest/config/index.js +1 -0
  14. package/dest/config/pipelining-config.d.ts +19 -0
  15. package/dest/config/pipelining-config.d.ts.map +1 -0
  16. package/dest/config/pipelining-config.js +18 -0
  17. package/dest/config/sequencer-config.d.ts +3 -1
  18. package/dest/config/sequencer-config.d.ts.map +1 -1
  19. package/dest/config/sequencer-config.js +1 -0
  20. package/dest/contract/contract_address.d.ts +3 -3
  21. package/dest/contract/contract_address.js +3 -3
  22. package/dest/contract/contract_class_id.d.ts +2 -2
  23. package/dest/contract/contract_class_id.js +2 -2
  24. package/dest/contract/index.d.ts +1 -3
  25. package/dest/contract/index.d.ts.map +1 -1
  26. package/dest/contract/index.js +0 -2
  27. package/dest/contract/interfaces/contract_class.d.ts +3 -156
  28. package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
  29. package/dest/contract/interfaces/contract_class.js +1 -28
  30. package/dest/epoch-helpers/index.d.ts +3 -1
  31. package/dest/epoch-helpers/index.d.ts.map +1 -1
  32. package/dest/epoch-helpers/index.js +6 -0
  33. package/dest/gas/gas_fees.d.ts +1 -1
  34. package/dest/gas/gas_fees.d.ts.map +1 -1
  35. package/dest/gas/gas_fees.js +4 -1
  36. package/dest/ha-signing/config.d.ts +136 -0
  37. package/dest/ha-signing/config.d.ts.map +1 -0
  38. package/dest/ha-signing/config.js +97 -0
  39. package/dest/ha-signing/index.d.ts +4 -0
  40. package/dest/ha-signing/index.d.ts.map +1 -0
  41. package/dest/ha-signing/index.js +3 -0
  42. package/dest/ha-signing/local_config.d.ts +63 -0
  43. package/dest/ha-signing/local_config.d.ts.map +1 -0
  44. package/dest/ha-signing/local_config.js +24 -0
  45. package/dest/ha-signing/types.d.ts +85 -0
  46. package/dest/ha-signing/types.d.ts.map +1 -0
  47. package/dest/ha-signing/types.js +32 -0
  48. package/dest/hash/hash.d.ts +16 -1
  49. package/dest/hash/hash.d.ts.map +1 -1
  50. package/dest/hash/hash.js +24 -0
  51. package/dest/interfaces/aztec-node-admin.d.ts +16 -4
  52. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  53. package/dest/interfaces/aztec-node.d.ts +2 -1
  54. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  55. package/dest/interfaces/block-builder.d.ts +25 -6
  56. package/dest/interfaces/block-builder.d.ts.map +1 -1
  57. package/dest/interfaces/configs.d.ts +7 -2
  58. package/dest/interfaces/configs.d.ts.map +1 -1
  59. package/dest/interfaces/configs.js +1 -0
  60. package/dest/interfaces/l2_logs_source.d.ts +5 -3
  61. package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
  62. package/dest/interfaces/proving-job.d.ts +200 -200
  63. package/dest/interfaces/validator.d.ts +37 -17
  64. package/dest/interfaces/validator.d.ts.map +1 -1
  65. package/dest/interfaces/validator.js +2 -2
  66. package/dest/interfaces/world_state.d.ts +5 -4
  67. package/dest/interfaces/world_state.d.ts.map +1 -1
  68. package/dest/kv-store/config.d.ts +17 -0
  69. package/dest/kv-store/config.d.ts.map +1 -0
  70. package/dest/kv-store/config.js +26 -0
  71. package/dest/kv-store/index.d.ts +2 -0
  72. package/dest/kv-store/index.d.ts.map +1 -0
  73. package/dest/kv-store/index.js +1 -0
  74. package/dest/logs/index.d.ts +2 -1
  75. package/dest/logs/index.d.ts.map +1 -1
  76. package/dest/logs/index.js +1 -0
  77. package/dest/logs/tagging_index_range.d.ts +40 -0
  78. package/dest/logs/tagging_index_range.d.ts.map +1 -0
  79. package/dest/logs/tagging_index_range.js +8 -0
  80. package/dest/messaging/l1_to_l2_message_source.d.ts +4 -2
  81. package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
  82. package/dest/noir/index.d.ts +3 -3
  83. package/dest/noir/index.d.ts.map +1 -1
  84. package/dest/p2p/block_proposal.d.ts +2 -2
  85. package/dest/p2p/block_proposal.d.ts.map +1 -1
  86. package/dest/p2p/block_proposal.js +1 -1
  87. package/dest/p2p/checkpoint_proposal.d.ts +2 -2
  88. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  89. package/dest/p2p/checkpoint_proposal.js +1 -1
  90. package/dest/tests/factories.d.ts +2 -4
  91. package/dest/tests/factories.d.ts.map +1 -1
  92. package/dest/tests/factories.js +0 -27
  93. package/dest/tx/private_execution_result.d.ts +6 -6
  94. package/dest/tx/private_execution_result.d.ts.map +1 -1
  95. package/dest/tx/private_execution_result.js +6 -6
  96. package/dest/tx/profiling.d.ts +14 -2
  97. package/dest/tx/profiling.d.ts.map +1 -1
  98. package/dest/tx/profiling.js +13 -3
  99. package/dest/tx/simulated_tx.d.ts +109 -1
  100. package/dest/tx/simulated_tx.d.ts.map +1 -1
  101. package/dest/tx/validator/error_texts.d.ts +3 -1
  102. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  103. package/dest/tx/validator/error_texts.js +3 -0
  104. package/package.json +11 -10
  105. package/src/abi/abi.ts +25 -2
  106. package/src/abi/buffer.ts +25 -4
  107. package/src/block/l2_block_source.ts +4 -2
  108. package/src/checkpoint/validate.ts +2 -2
  109. package/src/config/index.ts +1 -0
  110. package/src/config/pipelining-config.ts +31 -0
  111. package/src/config/sequencer-config.ts +3 -0
  112. package/src/contract/contract_address.ts +3 -3
  113. package/src/contract/contract_class_id.ts +2 -2
  114. package/src/contract/index.ts +0 -2
  115. package/src/contract/interfaces/contract_class.ts +2 -82
  116. package/src/epoch-helpers/index.ts +11 -0
  117. package/src/gas/README.md +123 -0
  118. package/src/gas/gas_fees.ts +7 -1
  119. package/src/ha-signing/config.ts +156 -0
  120. package/src/ha-signing/index.ts +27 -0
  121. package/src/ha-signing/local_config.ts +46 -0
  122. package/src/ha-signing/types.ts +112 -0
  123. package/src/hash/hash.ts +29 -0
  124. package/src/interfaces/aztec-node.ts +1 -0
  125. package/src/interfaces/block-builder.ts +27 -3
  126. package/src/interfaces/configs.ts +4 -1
  127. package/src/interfaces/l2_logs_source.ts +4 -1
  128. package/src/interfaces/validator.ts +40 -34
  129. package/src/interfaces/world_state.ts +4 -3
  130. package/src/kv-store/config.ts +36 -0
  131. package/src/kv-store/index.ts +1 -0
  132. package/src/logs/index.ts +1 -0
  133. package/src/logs/tagging_index_range.ts +24 -0
  134. package/src/messaging/l1_to_l2_message_source.ts +3 -1
  135. package/src/noir/index.ts +2 -2
  136. package/src/p2p/block_proposal.ts +1 -1
  137. package/src/p2p/checkpoint_proposal.ts +1 -1
  138. package/src/tests/factories.ts +0 -33
  139. package/src/tx/private_execution_result.ts +5 -5
  140. package/src/tx/profiling.ts +11 -2
  141. package/src/tx/validator/error_texts.ts +4 -0
  142. package/dest/contract/private_function_membership_proof.d.ts +0 -32
  143. package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
  144. package/dest/contract/private_function_membership_proof.js +0 -124
  145. package/dest/contract/utility_function_membership_proof.d.ts +0 -27
  146. package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
  147. package/dest/contract/utility_function_membership_proof.js +0 -87
  148. package/src/contract/private_function_membership_proof.ts +0 -167
  149. package/src/contract/utility_function_membership_proof.ts +0 -118
@@ -35,7 +35,8 @@ export interface IBlockFactory extends ProcessedTxHandler {
35
35
  setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2Block>;
36
36
  }
37
37
 
38
- export interface PublicProcessorLimits {
38
+ /** Limits passed to the public processor for tx processing within a block. */
39
+ export type PublicProcessorLimits = {
39
40
  /** Maximum number of txs to process. */
40
41
  maxTransactions?: number;
41
42
  /** L2 and DA gas limits. */
@@ -46,7 +47,30 @@ export interface PublicProcessorLimits {
46
47
  deadline?: Date;
47
48
  /** 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
49
  isBuildingProposal?: boolean;
49
- }
50
+ };
51
+
52
+ /** Base fields shared by both proposer and validator block builder options. */
53
+ type BlockBuilderOptionsBase = PublicProcessorLimits & {
54
+ /** Minimum number of successfully processed txs required. Block is rejected if fewer succeed. */
55
+ minValidTxs: number;
56
+ };
57
+
58
+ /** Proposer mode: redistribution params are required. */
59
+ type ProposerBlockBuilderOptions = BlockBuilderOptionsBase & {
60
+ isBuildingProposal: true;
61
+ /** Maximum number of blocks per checkpoint, derived from the timetable. */
62
+ maxBlocksPerCheckpoint: number;
63
+ /** Per-block gas budget multiplier. Budget = (remaining / remainingBlocks) * multiplier. */
64
+ perBlockAllocationMultiplier: number;
65
+ };
66
+
67
+ /** Validator mode: no redistribution params needed. */
68
+ type ValidatorBlockBuilderOptions = BlockBuilderOptionsBase & {
69
+ isBuildingProposal: false;
70
+ };
71
+
72
+ /** Options for building a block within a checkpoint. When proposing, redistribution params are required. */
73
+ export type BlockBuilderOptions = ProposerBlockBuilderOptions | ValidatorBlockBuilderOptions;
50
74
 
51
75
  export interface PublicProcessorValidator {
52
76
  preprocessValidator?: TxValidator<Tx>;
@@ -109,7 +133,7 @@ export interface ICheckpointBlockBuilder {
109
133
  pendingTxs: Iterable<Tx> | AsyncIterable<Tx>,
110
134
  blockNumber: BlockNumber,
111
135
  timestamp: bigint,
112
- opts: PublicProcessorLimits & { minValidTxs?: number },
136
+ opts: BlockBuilderOptions,
113
137
  ): Promise<BuildBlockInCheckpointResult>;
114
138
  }
115
139
 
@@ -27,6 +27,8 @@ export interface SequencerConfig {
27
27
  maxDABlockGas?: number;
28
28
  /** Per-block gas budget multiplier for both L2 and DA gas. Budget = (checkpointLimit / maxBlocks) * multiplier. */
29
29
  perBlockAllocationMultiplier?: number;
30
+ /** Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget. */
31
+ redistributeCheckpointBudget?: boolean;
30
32
  /** Recipient of block reward. */
31
33
  coinbase?: EthAddress;
32
34
  /** Address to receive fees. */
@@ -94,6 +96,7 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
94
96
  publishTxsWithProposals: z.boolean().optional(),
95
97
  maxDABlockGas: z.number().optional(),
96
98
  perBlockAllocationMultiplier: z.number().optional(),
99
+ redistributeCheckpointBudget: z.boolean().optional(),
97
100
  coinbase: schemas.EthAddress.optional(),
98
101
  feeRecipient: schemas.AztecAddress.optional(),
99
102
  acvmWorkingDirectory: z.string().optional(),
@@ -142,7 +145,7 @@ type SequencerConfigOptionalKeys =
142
145
  | 'maxTxsPerCheckpoint'
143
146
  | 'maxL2BlockGas'
144
147
  | 'maxDABlockGas'
145
- | 'perBlockAllocationMultiplier';
148
+ | 'redistributeCheckpointBudget';
146
149
 
147
150
  export type ResolvedSequencerConfig = Prettify<
148
151
  Required<Omit<SequencerConfig, SequencerConfigOptionalKeys>> & Pick<SequencerConfig, SequencerConfigOptionalKeys>
@@ -16,10 +16,11 @@ export interface L2LogsSource {
16
16
  * array implies no logs match that tag.
17
17
  * @param tags - The tags to search for.
18
18
  * @param page - The page number (0-indexed) for pagination.
19
+ * @param upToBlockNumber - If set, only return logs from blocks up to and including this block number.
19
20
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
20
21
  * for a tag, the caller should fetch the next page to check for more logs.
21
22
  */
22
- getPrivateLogsByTags(tags: SiloedTag[], page?: number): Promise<TxScopedL2Log[][]>;
23
+ getPrivateLogsByTags(tags: SiloedTag[], page?: number, upToBlockNumber?: BlockNumber): Promise<TxScopedL2Log[][]>;
23
24
 
24
25
  /**
25
26
  * Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
@@ -27,6 +28,7 @@ export interface L2LogsSource {
27
28
  * @param contractAddress - The contract address to search logs for.
28
29
  * @param tags - The tags to search for.
29
30
  * @param page - The page number (0-indexed) for pagination.
31
+ * @param upToBlockNumber - If set, only return logs from blocks up to and including this block number.
30
32
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
31
33
  * for a tag, the caller should fetch the next page to check for more logs.
32
34
  */
@@ -34,6 +36,7 @@ export interface L2LogsSource {
34
36
  contractAddress: AztecAddress,
35
37
  tags: Tag[],
36
38
  page?: number,
39
+ upToBlockNumber?: BlockNumber,
37
40
  ): Promise<TxScopedL2Log[][]>;
38
41
 
39
42
  /**
@@ -15,63 +15,69 @@ 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
- /** 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;
66
+ /** Agree to attest to equivocated checkpoint proposals (for testing purposes only) */
67
+ attestToEquivocatedProposals?: boolean;
62
68
 
63
- /** Maximum L2 gas per block for validation. Proposals exceeding this limit are rejected. */
64
- validateMaxL2BlockGas?: number;
69
+ /** Maximum L2 gas per block for validation. Proposals exceeding this limit are rejected. */
70
+ validateMaxL2BlockGas?: number;
65
71
 
66
- /** Maximum DA gas per block for validation. Proposals exceeding this limit are rejected. */
67
- validateMaxDABlockGas?: number;
72
+ /** Maximum DA gas per block for validation. Proposals exceeding this limit are rejected. */
73
+ validateMaxDABlockGas?: number;
68
74
 
69
- /** Maximum transactions per block for validation. Proposals exceeding this limit are rejected. */
70
- validateMaxTxsPerBlock?: number;
75
+ /** Maximum transactions per block for validation. Proposals exceeding this limit are rejected. */
76
+ validateMaxTxsPerBlock?: number;
71
77
 
72
- /** Maximum transactions per checkpoint for validation. Proposals exceeding this limit are rejected. */
73
- validateMaxTxsPerCheckpoint?: number;
74
- };
78
+ /** Maximum transactions per checkpoint for validation. Proposals exceeding this limit are rejected. */
79
+ validateMaxTxsPerCheckpoint?: number;
80
+ };
75
81
 
76
82
  export type ValidatorClientFullConfig = ValidatorClientConfig &
77
83
  Pick<SequencerConfig, 'txPublicSetupAllowListExtend' | 'broadcastInvalidBlockProposal'> &
@@ -87,7 +93,7 @@ export type ValidatorClientFullConfig = ValidatorClientConfig &
87
93
  };
88
94
 
89
95
  export const ValidatorClientConfigSchema = zodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>()(
90
- ValidatorHASignerConfigSchema.extend({
96
+ ValidatorHASignerConfigSchema.merge(LocalSignerConfigSchema).extend({
91
97
  validatorAddresses: z.array(schemas.EthAddress).optional(),
92
98
  disableValidator: z.boolean(),
93
99
  disabledValidators: z.array(schemas.EthAddress),
@@ -3,6 +3,7 @@ import type { PromiseWithResolvers } from '@aztec/foundation/promise';
3
3
 
4
4
  import { z } from 'zod';
5
5
 
6
+ import type { BlockHash } from '../block/block_hash.js';
6
7
  import type { SnapshotDataKeys } from '../snapshots/types.js';
7
8
  import type { MerkleTreeReadOperations, MerkleTreeWriteOperations } from './merkle_tree_operations.js';
8
9
 
@@ -80,12 +81,12 @@ export interface WorldStateSynchronizer extends ReadonlyWorldStateAccess, ForkMe
80
81
  resumeSync(): void;
81
82
 
82
83
  /**
83
- * Forces an immediate sync to an optionally provided minimum block number
84
+ * Forces an immediate sync to an optionally provided minimum block number.
84
85
  * @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
85
- * @param skipThrowIfTargetNotReached - Whether to skip throwing if the target block number is not reached.
86
+ * @param blockHash - If provided, verifies the block at targetBlockNumber matches this hash. On mismatch, triggers a resync (reorg detection).
86
87
  * @returns A promise that resolves with the block number the world state was synced to
87
88
  */
88
- syncImmediate(minBlockNumber?: BlockNumber, skipThrowIfTargetNotReached?: boolean): Promise<BlockNumber>;
89
+ syncImmediate(minBlockNumber?: BlockNumber, blockHash?: BlockHash): Promise<BlockNumber>;
89
90
 
90
91
  /** Deletes the db */
91
92
  clear(): Promise<void>;
@@ -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';
package/src/logs/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './extended_directional_app_tagging_secret.js';
2
2
  export * from './pre_tag.js';
3
+ export * from './tagging_index_range.js';
3
4
  export * from './contract_class_log.js';
4
5
  export * from './public_log.js';
5
6
  export * from './private_log.js';
@@ -0,0 +1,24 @@
1
+ import { schemas } from '@aztec/foundation/schemas';
2
+
3
+ import { z } from 'zod';
4
+
5
+ import {
6
+ type ExtendedDirectionalAppTaggingSecret,
7
+ ExtendedDirectionalAppTaggingSecretSchema,
8
+ } from './extended_directional_app_tagging_secret.js';
9
+
10
+ /**
11
+ * Represents a range of tagging indexes for a given extended directional app tagging secret. Used to track the lowest
12
+ * and highest indexes used in a transaction for a given (sender, recipient, app/contract) tuple.
13
+ */
14
+ export type TaggingIndexRange = {
15
+ extendedSecret: ExtendedDirectionalAppTaggingSecret;
16
+ lowestIndex: number;
17
+ highestIndex: number;
18
+ };
19
+
20
+ export const TaggingIndexRangeSchema = z.object({
21
+ extendedSecret: ExtendedDirectionalAppTaggingSecretSchema,
22
+ lowestIndex: schemas.Integer,
23
+ highestIndex: schemas.Integer,
24
+ });
@@ -10,7 +10,9 @@ export interface L1ToL2MessageSource {
10
10
  /**
11
11
  * Gets new L1 to L2 message (to be) included in a given checkpoint.
12
12
  * @param checkpointNumber - Checkpoint number to get messages for.
13
- * @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
13
+ * @returns The L1 to L2 messages/leaves of the messages subtree.
14
+ * @throws If the message tree for the given checkpoint has not yet been sealed on L1
15
+ * (i.e., checkpointNumber >= inbox treeInProgress).
14
16
  */
15
17
  getL1ToL2Messages(checkpointNumber: CheckpointNumber): Promise<Fr[]>;
16
18
 
package/src/noir/index.ts CHANGED
@@ -19,7 +19,7 @@ export const AZTEC_VIEW_ATTRIBUTE = 'abi_view';
19
19
  export interface NoirFunctionAbi {
20
20
  /** The parameters of the function. */
21
21
  parameters: ABIParameter[];
22
- /** The return type of the function. */
22
+ /** The return type of the function, or null for void functions. */
23
23
  return_type: {
24
24
  /**
25
25
  * The type of the return value.
@@ -29,7 +29,7 @@ export interface NoirFunctionAbi {
29
29
  * The visibility of the return value.
30
30
  */
31
31
  visibility: ABIParameterVisibility;
32
- };
32
+ } | null;
33
33
  /** Mapping of error selector => error type */
34
34
  error_types: Partial<Record<string, AbiErrorType>>;
35
35
  }
@@ -6,11 +6,11 @@ import { Fr } from '@aztec/foundation/curves/bn254';
6
6
  import type { EthAddress } from '@aztec/foundation/eth-address';
7
7
  import { Signature } from '@aztec/foundation/eth-signature';
8
8
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
9
- import { DutyType, type SigningContext } from '@aztec/validator-ha-signer/types';
10
9
 
11
10
  import type { L2Block } from '../block/l2_block.js';
12
11
  import type { L2BlockInfo } from '../block/l2_block_info.js';
13
12
  import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
13
+ import { DutyType, type SigningContext } from '../ha-signing/index.js';
14
14
  import { BlockHeader } from '../tx/block_header.js';
15
15
  import { TxHash } from '../tx/index.js';
16
16
  import type { Tx } from '../tx/tx.js';
@@ -6,10 +6,10 @@ import { Fr } from '@aztec/foundation/curves/bn254';
6
6
  import type { EthAddress } from '@aztec/foundation/eth-address';
7
7
  import { Signature } from '@aztec/foundation/eth-signature';
8
8
  import { BufferReader, serializeSignedBigInt, serializeToBuffer } from '@aztec/foundation/serialize';
9
- import { DutyType, type SigningContext } from '@aztec/validator-ha-signer/types';
10
9
 
11
10
  import type { L2BlockInfo } from '../block/l2_block_info.js';
12
11
  import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
12
+ import { DutyType, type SigningContext } from '../ha-signing/index.js';
13
13
  import { CheckpointHeader } from '../rollup/checkpoint_header.js';
14
14
  import { BlockHeader } from '../tx/block_header.js';
15
15
  import { TxHash } from '../tx/index.js';
@@ -92,10 +92,8 @@ import {
92
92
  type ContractClassPublic,
93
93
  ContractDeploymentData,
94
94
  type ContractInstanceWithAddress,
95
- type ExecutablePrivateFunctionWithMembershipProof,
96
95
  type PrivateFunction,
97
96
  SerializableContractInstance,
98
- type UtilityFunctionWithMembershipProof,
99
97
  computeContractClassId,
100
98
  computePublicBytecodeCommitment,
101
99
  } from '../contract/index.js';
@@ -1183,35 +1181,6 @@ export function makePublicTxBaseRollupPrivateInputs(seed = 0) {
1183
1181
  });
1184
1182
  }
1185
1183
 
1186
- export function makeExecutablePrivateFunctionWithMembershipProof(
1187
- seed = 0,
1188
- ): ExecutablePrivateFunctionWithMembershipProof {
1189
- return {
1190
- selector: makeSelector(seed),
1191
- bytecode: makeBytes(100, seed + 1),
1192
- artifactTreeSiblingPath: makeTuple(3, fr, seed + 2),
1193
- artifactTreeLeafIndex: seed + 2,
1194
- privateFunctionTreeSiblingPath: makeTuple(3, fr, seed + 3),
1195
- privateFunctionTreeLeafIndex: seed + 3,
1196
- artifactMetadataHash: fr(seed + 4),
1197
- functionMetadataHash: fr(seed + 5),
1198
- utilityFunctionsTreeRoot: fr(seed + 6),
1199
- vkHash: fr(seed + 7),
1200
- };
1201
- }
1202
-
1203
- export function makeUtilityFunctionWithMembershipProof(seed = 0): UtilityFunctionWithMembershipProof {
1204
- return {
1205
- selector: makeSelector(seed),
1206
- bytecode: makeBytes(100, seed + 1),
1207
- artifactTreeSiblingPath: makeTuple(3, fr, seed + 2),
1208
- artifactTreeLeafIndex: seed + 2,
1209
- artifactMetadataHash: fr(seed + 4),
1210
- functionMetadataHash: fr(seed + 5),
1211
- privateFunctionsArtifactTreeRoot: fr(seed + 6),
1212
- };
1213
- }
1214
-
1215
1184
  export async function makeContractClassPublic(seed = 0, publicBytecode?: Buffer): Promise<ContractClassPublic> {
1216
1185
  const artifactHash = fr(seed + 1);
1217
1186
  const privateFunctionsRoot = fr(seed + 3);
@@ -1223,8 +1192,6 @@ export async function makeContractClassPublic(seed = 0, publicBytecode?: Buffer)
1223
1192
  artifactHash,
1224
1193
  packedBytecode,
1225
1194
  privateFunctionsRoot,
1226
- privateFunctions: [],
1227
- utilityFunctions: [],
1228
1195
  version: 1,
1229
1196
  };
1230
1197
  }
@@ -11,7 +11,7 @@ import { PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inp
11
11
  import type { IsEmpty } from '../kernel/utils/interfaces.js';
12
12
  import { sortByCounter } from '../kernel/utils/order_and_comparison.js';
13
13
  import { ContractClassLog, ContractClassLogFields } from '../logs/contract_class_log.js';
14
- import { type PreTag, PreTagSchema } from '../logs/pre_tag.js';
14
+ import { type TaggingIndexRange, TaggingIndexRangeSchema } from '../logs/tagging_index_range.js';
15
15
  import { Note } from '../note/note.js';
16
16
  import { type ZodFor, mapSchema, schemas } from '../schemas/index.js';
17
17
  import { HashedValues } from './hashed_values.js';
@@ -137,8 +137,8 @@ export class PrivateCallExecutionResult {
137
137
  public returnValues: Fr[],
138
138
  /** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */
139
139
  public offchainEffects: { data: Fr[] }[],
140
- /** The pre-tags used in this tx to compute tags for private logs */
141
- public preTags: PreTag[],
140
+ /** The tagging index ranges used in this tx to compute tags for private logs */
141
+ public taggingIndexRanges: TaggingIndexRange[],
142
142
  /** The nested executions. */
143
143
  public nestedExecutionResults: PrivateCallExecutionResult[],
144
144
  /**
@@ -161,7 +161,7 @@ export class PrivateCallExecutionResult {
161
161
  noteHashNullifierCounterMap: mapSchema(z.coerce.number(), z.number()),
162
162
  returnValues: z.array(schemas.Fr),
163
163
  offchainEffects: z.array(z.object({ data: z.array(schemas.Fr) })),
164
- preTags: z.array(PreTagSchema),
164
+ taggingIndexRanges: z.array(TaggingIndexRangeSchema),
165
165
  nestedExecutionResults: z.array(z.lazy(() => PrivateCallExecutionResult.schema)),
166
166
  contractClassLogs: z.array(CountedContractClassLog.schema),
167
167
  })
@@ -178,7 +178,7 @@ export class PrivateCallExecutionResult {
178
178
  fields.noteHashNullifierCounterMap,
179
179
  fields.returnValues,
180
180
  fields.offchainEffects,
181
- fields.preTags,
181
+ fields.taggingIndexRanges,
182
182
  fields.nestedExecutionResults,
183
183
  fields.contractClassLogs,
184
184
  );
@@ -3,6 +3,7 @@ import { type ZodFor, optional, schemas } from '@aztec/foundation/schemas';
3
3
 
4
4
  import { z } from 'zod';
5
5
 
6
+ import { AztecAddress } from '../aztec-address/index.js';
6
7
  import type { AztecNode } from '../interfaces/aztec-node.js';
7
8
  import { type PrivateExecutionStep, PrivateExecutionStepSchema } from '../kernel/private_kernel_prover_output.js';
8
9
 
@@ -160,6 +161,9 @@ export class TxProfileResult {
160
161
  export class UtilityExecutionResult {
161
162
  constructor(
162
163
  public result: Fr[],
164
+ public offchainEffects: { data: Fr[]; contractAddress: AztecAddress }[],
165
+ /** Timestamp of the anchor block used during utility execution. */
166
+ public anchorBlockTimestamp: bigint,
163
167
  public stats?: SimulationStats,
164
168
  ) {}
165
169
 
@@ -167,13 +171,18 @@ export class UtilityExecutionResult {
167
171
  return z
168
172
  .object({
169
173
  result: z.array(schemas.Fr),
174
+ offchainEffects: z.array(z.object({ data: z.array(schemas.Fr), contractAddress: AztecAddress.schema })),
175
+ anchorBlockTimestamp: schemas.BigInt,
170
176
  stats: optional(SimulationStatsSchema),
171
177
  })
172
- .transform(({ result, stats }) => new UtilityExecutionResult(result, stats));
178
+ .transform(
179
+ ({ result, offchainEffects, anchorBlockTimestamp, stats }) =>
180
+ new UtilityExecutionResult(result, offchainEffects, anchorBlockTimestamp, stats),
181
+ );
173
182
  }
174
183
 
175
184
  static random(): UtilityExecutionResult {
176
- return new UtilityExecutionResult([Fr.random()], {
185
+ return new UtilityExecutionResult([Fr.random()], [], 0n, {
177
186
  nodeRPCCalls: {
178
187
  perMethod: { getBlockHeader: { times: [1] } },
179
188
  roundTrips: {
@@ -45,5 +45,9 @@ export const TX_ERROR_BLOCK_HEADER = 'Block header not found';
45
45
  export const TX_ERROR_INCORRECT_CONTRACT_ADDRESS = 'Incorrect contract instance deployment address';
46
46
  export const TX_ERROR_MALFORMED_CONTRACT_INSTANCE_LOG = 'Failed to parse contract instance deployment log';
47
47
 
48
+ // Contract class
49
+ export const TX_ERROR_INCORRECT_CONTRACT_CLASS_ID = 'Incorrect contract class id';
50
+ export const TX_ERROR_MALFORMED_CONTRACT_CLASS_LOG = 'Failed to parse contract class registration log';
51
+
48
52
  // General
49
53
  export const TX_ERROR_DURING_VALIDATION = 'Unexpected error during validation';
@@ -1,32 +0,0 @@
1
- import { type ContractArtifact, FunctionSelector } from '../abi/index.js';
2
- import type { ContractClassPublic, ExecutablePrivateFunctionWithMembershipProof, PrivateFunctionMembershipProof } from './interfaces/index.js';
3
- /**
4
- * Creates a membership proof for a private function in a contract class, to be verified via `isValidPrivateFunctionMembershipProof`.
5
- * @param selector - Selector of the function to create the proof for.
6
- * @param artifact - Artifact of the contract class where the function is defined.
7
- */
8
- export declare function createPrivateFunctionMembershipProof(selector: FunctionSelector, artifact: ContractArtifact): Promise<PrivateFunctionMembershipProof>;
9
- /**
10
- * Verifies that a private function with a membership proof as emitted by the ClassRegistry contract is valid,
11
- * as defined in the protocol specs at contract-deployment/classes:
12
- *
13
- * ```
14
- * // Load contract class from local db
15
- * contract_class = db.get_contract_class(contract_class_id)
16
- *
17
- * // Compute function leaf and assert it belongs to the private functions tree
18
- * function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF)
19
- * computed_private_function_tree_root = compute_root(function_leaf, private_function_tree_sibling_path)
20
- * assert computed_private_function_tree_root == contract_class.private_functions_root
21
- *
22
- * // Compute artifact leaf and assert it belongs to the artifact
23
- * artifact_function_leaf = sha256(selector, metadata_hash, sha256(bytecode))
24
- * computed_artifact_private_function_tree_root = compute_root(artifact_function_leaf, artifact_function_tree_sibling_path)
25
- * computed_artifact_hash = sha256(computed_artifact_private_function_tree_root, utility_functions_artifact_tree_root, artifact_metadata_hash)
26
- * assert computed_artifact_hash == contract_class.artifact_hash
27
- * ```
28
- * @param fn - Function to check membership proof for.
29
- * @param contractClass - In which contract class the function is expected to be.
30
- */
31
- export declare function isValidPrivateFunctionMembershipProof(fn: ExecutablePrivateFunctionWithMembershipProof, contractClass: Pick<ContractClassPublic, 'privateFunctionsRoot' | 'artifactHash'>): Promise<boolean>;
32
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9mdW5jdGlvbl9tZW1iZXJzaGlwX3Byb29mLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3QvcHJpdmF0ZV9mdW5jdGlvbl9tZW1iZXJzaGlwX3Byb29mLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUFFLGdCQUFnQixFQUFnQixNQUFNLGlCQUFpQixDQUFDO0FBVXhGLE9BQU8sS0FBSyxFQUNWLG1CQUFtQixFQUNuQiw0Q0FBNEMsRUFDNUMsOEJBQThCLEVBQy9CLE1BQU0sdUJBQXVCLENBQUM7QUFHL0I7Ozs7R0FJRztBQUNILHdCQUFzQixvQ0FBb0MsQ0FDeEQsUUFBUSxFQUFFLGdCQUFnQixFQUMxQixRQUFRLEVBQUUsZ0JBQWdCLEdBQ3pCLE9BQU8sQ0FBQyw4QkFBOEIsQ0FBQyxDQTREekM7QUFFRDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBcUJHO0FBQ0gsd0JBQXNCLHFDQUFxQyxDQUN6RCxFQUFFLEVBQUUsNENBQTRDLEVBQ2hELGFBQWEsRUFBRSxJQUFJLENBQUMsbUJBQW1CLEVBQUUsc0JBQXNCLEdBQUcsY0FBYyxDQUFDLG9CQWtEbEYifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"private_function_membership_proof.d.ts","sourceRoot":"","sources":["../../src/contract/private_function_membership_proof.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,iBAAiB,CAAC;AAUxF,OAAO,KAAK,EACV,mBAAmB,EACnB,4CAA4C,EAC5C,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAG/B;;;;GAIG;AACH,wBAAsB,oCAAoC,CACxD,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,8BAA8B,CAAC,CA4DzC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,qCAAqC,CACzD,EAAE,EAAE,4CAA4C,EAChD,aAAa,EAAE,IAAI,CAAC,mBAAmB,EAAE,sBAAsB,GAAG,cAAc,CAAC,oBAkDlF"}