@aztec/stdlib 0.0.1-commit.2ed92850 → 0.0.1-commit.43c09e3f

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 (131) hide show
  1. package/dest/block/block_hash.d.ts +16 -19
  2. package/dest/block/block_hash.d.ts.map +1 -1
  3. package/dest/block/block_hash.js +21 -34
  4. package/dest/block/block_parameter.d.ts +4 -4
  5. package/dest/block/block_parameter.d.ts.map +1 -1
  6. package/dest/block/block_parameter.js +2 -2
  7. package/dest/block/in_block.d.ts +9 -9
  8. package/dest/block/in_block.d.ts.map +1 -1
  9. package/dest/block/in_block.js +4 -4
  10. package/dest/block/l2_block.d.ts +3 -2
  11. package/dest/block/l2_block.d.ts.map +1 -1
  12. package/dest/block/l2_block.js +2 -3
  13. package/dest/block/l2_block_source.d.ts +5 -4
  14. package/dest/block/l2_block_source.d.ts.map +1 -1
  15. package/dest/contract/contract_address.js +1 -1
  16. package/dest/contract/contract_class_id.d.ts +1 -1
  17. package/dest/contract/contract_class_id.js +1 -1
  18. package/dest/contract/private_function.js +1 -1
  19. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  20. package/dest/contract/private_function_membership_proof.js +1 -1
  21. package/dest/database-version/database_version.d.ts +58 -0
  22. package/dest/database-version/database_version.d.ts.map +1 -0
  23. package/dest/database-version/database_version.js +69 -0
  24. package/dest/database-version/version_manager.d.ts +2 -50
  25. package/dest/database-version/version_manager.d.ts.map +1 -1
  26. package/dest/database-version/version_manager.js +1 -66
  27. package/dest/epoch-helpers/index.d.ts +3 -1
  28. package/dest/epoch-helpers/index.d.ts.map +1 -1
  29. package/dest/epoch-helpers/index.js +4 -0
  30. package/dest/hash/hash.js +2 -2
  31. package/dest/hash/map_slot.d.ts +1 -1
  32. package/dest/hash/map_slot.d.ts.map +1 -1
  33. package/dest/hash/map_slot.js +4 -3
  34. package/dest/interfaces/archiver.d.ts +1 -1
  35. package/dest/interfaces/archiver.d.ts.map +1 -1
  36. package/dest/interfaces/archiver.js +4 -3
  37. package/dest/interfaces/aztec-node-admin.d.ts +8 -2
  38. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  39. package/dest/interfaces/aztec-node-admin.js +3 -1
  40. package/dest/interfaces/aztec-node.d.ts +33 -54
  41. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  42. package/dest/interfaces/aztec-node.js +6 -10
  43. package/dest/interfaces/block-builder.d.ts +10 -4
  44. package/dest/interfaces/block-builder.d.ts.map +1 -1
  45. package/dest/interfaces/block-builder.js +7 -0
  46. package/dest/interfaces/get_logs_response.d.ts +15 -8
  47. package/dest/interfaces/get_logs_response.d.ts.map +1 -1
  48. package/dest/interfaces/prover-broker.d.ts +16 -1
  49. package/dest/interfaces/prover-broker.d.ts.map +1 -1
  50. package/dest/interfaces/prover-broker.js +4 -1
  51. package/dest/interfaces/prover-client.d.ts +6 -1
  52. package/dest/interfaces/prover-client.d.ts.map +1 -1
  53. package/dest/interfaces/prover-client.js +5 -0
  54. package/dest/interfaces/proving-job.d.ts +34 -34
  55. package/dest/interfaces/validator.d.ts +34 -2
  56. package/dest/interfaces/validator.d.ts.map +1 -1
  57. package/dest/keys/derivation.d.ts +3 -3
  58. package/dest/keys/derivation.js +8 -8
  59. package/dest/keys/key_types.d.ts +1 -1
  60. package/dest/keys/utils.d.ts +1 -1
  61. package/dest/keys/utils.d.ts.map +1 -1
  62. package/dest/keys/utils.js +7 -3
  63. package/dest/l1-contracts/slash_factory.d.ts +1 -1
  64. package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
  65. package/dest/l1-contracts/slash_factory.js +1 -0
  66. package/dest/logs/extended_public_log.d.ts +13 -7
  67. package/dest/logs/extended_public_log.d.ts.map +1 -1
  68. package/dest/logs/log_id.d.ts +17 -14
  69. package/dest/logs/log_id.d.ts.map +1 -1
  70. package/dest/logs/log_id.js +20 -17
  71. package/dest/logs/siloed_tag.d.ts +1 -1
  72. package/dest/logs/siloed_tag.d.ts.map +1 -1
  73. package/dest/logs/siloed_tag.js +4 -3
  74. package/dest/p2p/block_proposal.d.ts +10 -3
  75. package/dest/p2p/block_proposal.d.ts.map +1 -1
  76. package/dest/p2p/checkpoint_proposal.d.ts +10 -3
  77. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  78. package/dest/stats/stats.d.ts +1 -3
  79. package/dest/stats/stats.d.ts.map +1 -1
  80. package/dest/tests/mocks.d.ts +6 -2
  81. package/dest/tests/mocks.d.ts.map +1 -1
  82. package/dest/tests/mocks.js +4 -3
  83. package/dest/tx/block_header.d.ts +3 -3
  84. package/dest/tx/block_header.d.ts.map +1 -1
  85. package/dest/tx/block_header.js +3 -3
  86. package/dest/tx/in_tx.d.ts +3 -3
  87. package/dest/tx/indexed_tx_effect.d.ts +5 -5
  88. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  89. package/dest/tx/indexed_tx_effect.js +3 -2
  90. package/dest/tx/tx_receipt.d.ts +5 -5
  91. package/dest/tx/tx_receipt.d.ts.map +1 -1
  92. package/dest/tx/tx_receipt.js +2 -2
  93. package/package.json +22 -11
  94. package/src/block/block_hash.ts +25 -50
  95. package/src/block/block_parameter.ts +3 -3
  96. package/src/block/in_block.ts +5 -5
  97. package/src/block/l2_block.ts +3 -3
  98. package/src/block/l2_block_source.ts +4 -3
  99. package/src/contract/contract_address.ts +1 -1
  100. package/src/contract/contract_class_id.ts +1 -1
  101. package/src/contract/private_function.ts +1 -1
  102. package/src/contract/private_function_membership_proof.ts +1 -1
  103. package/src/database-version/database_version.ts +87 -0
  104. package/src/database-version/version_manager.ts +1 -77
  105. package/src/epoch-helpers/index.ts +9 -0
  106. package/src/hash/hash.ts +2 -2
  107. package/src/hash/map_slot.ts +3 -2
  108. package/src/interfaces/archiver.ts +4 -3
  109. package/src/interfaces/aztec-node-admin.ts +3 -2
  110. package/src/interfaces/aztec-node.ts +42 -93
  111. package/src/interfaces/block-builder.ts +12 -2
  112. package/src/interfaces/prover-broker.ts +22 -0
  113. package/src/interfaces/prover-client.ts +7 -0
  114. package/src/interfaces/validator.ts +1 -2
  115. package/src/keys/derivation.ts +8 -8
  116. package/src/keys/key_types.ts +1 -1
  117. package/src/keys/utils.ts +7 -3
  118. package/src/l1-contracts/slash_factory.ts +1 -0
  119. package/src/logs/log_id.ts +22 -18
  120. package/src/logs/siloed_tag.ts +3 -2
  121. package/src/p2p/block_proposal.ts +9 -2
  122. package/src/p2p/checkpoint_proposal.ts +9 -2
  123. package/src/stats/stats.ts +0 -2
  124. package/src/tests/mocks.ts +6 -4
  125. package/src/tx/block_header.ts +6 -6
  126. package/src/tx/indexed_tx_effect.ts +3 -2
  127. package/src/tx/tx_receipt.ts +4 -4
  128. package/dest/database-version/index.d.ts +0 -2
  129. package/dest/database-version/index.d.ts.map +0 -1
  130. package/dest/database-version/index.js +0 -1
  131. package/src/database-version/index.ts +0 -1
@@ -1,86 +1,10 @@
1
1
  import { EthAddress } from '@aztec/foundation/eth-address';
2
- import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
3
2
  import { type Logger, createLogger } from '@aztec/foundation/log';
4
3
 
5
4
  import fs from 'fs/promises';
6
- import { inspect } from 'node:util';
7
5
  import { join } from 'path';
8
- import { z } from 'zod';
9
6
 
10
- /**
11
- * Represents a version record for storing in a version file.
12
- */
13
- export class DatabaseVersion {
14
- constructor(
15
- /** The version of the data on disk. Used to perform upgrades */
16
- public readonly schemaVersion: number,
17
- /** The rollup the data pertains to */
18
- public readonly rollupAddress: EthAddress,
19
- ) {}
20
-
21
- public toBuffer(): Buffer {
22
- return Buffer.from(jsonStringify(this));
23
- }
24
-
25
- public static fromBuffer(buf: Buffer): DatabaseVersion {
26
- try {
27
- return jsonParseWithSchema(buf.toString('utf-8'), DatabaseVersion.schema);
28
- } catch (err) {
29
- throw new Error(`Failed to deserialize version information: ${err}`, { cause: err });
30
- }
31
- }
32
-
33
- /**
34
- * Compares two versions. If the rollups addresses are different then it returns undefined
35
- */
36
- public cmp(other: DatabaseVersion): undefined | -1 | 0 | 1 {
37
- if (this.rollupAddress.equals(other.rollupAddress)) {
38
- if (this.schemaVersion < other.schemaVersion) {
39
- return -1;
40
- } else if (this.schemaVersion > other.schemaVersion) {
41
- return 1;
42
- } else {
43
- return 0;
44
- }
45
- }
46
- return undefined;
47
- }
48
-
49
- /**
50
- * Checks if two versions exactly match
51
- */
52
- public equals(other: DatabaseVersion): boolean {
53
- return this.cmp(other) === 0;
54
- }
55
-
56
- /**
57
- * Returns the schema for this class
58
- */
59
- static get schema() {
60
- return z
61
- .object({
62
- schemaVersion: z.number(),
63
- rollupAddress: EthAddress.schema,
64
- })
65
- .transform(({ schemaVersion, rollupAddress }) => new DatabaseVersion(schemaVersion, rollupAddress));
66
- }
67
-
68
- /** Allows for better introspection. */
69
- public [inspect.custom](): string {
70
- return this.toString();
71
- }
72
-
73
- public toString(): string {
74
- return `DatabaseVersion{schemaVersion=${this.schemaVersion},rollupAddress=${this.rollupAddress}"}`;
75
- }
76
-
77
- /**
78
- * Returns an empty instance
79
- */
80
- static empty() {
81
- return new DatabaseVersion(0, EthAddress.ZERO);
82
- }
83
- }
7
+ import { DatabaseVersion } from './database_version.js';
84
8
 
85
9
  export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | 'writeFile' | 'rm' | 'mkdir'>;
86
10
 
@@ -51,6 +51,15 @@ export function getSlotAtTimestamp(
51
51
  : SlotNumber.fromBigInt((ts - constants.l1GenesisTime) / BigInt(constants.slotDuration));
52
52
  }
53
53
 
54
+ /** Returns the L2 slot number at the next L1 block based on the current timestamp. */
55
+ export function getSlotAtNextL1Block(
56
+ currentL1Timestamp: bigint,
57
+ constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>,
58
+ ): SlotNumber {
59
+ const nextL1BlockTimestamp = currentL1Timestamp + BigInt(constants.ethereumSlotDuration);
60
+ return getSlotAtTimestamp(nextL1BlockTimestamp, constants);
61
+ }
62
+
54
63
  /** Returns the epoch number for a given timestamp. */
55
64
  export function getEpochNumberAtTimestamp(
56
65
  ts: bigint,
package/src/hash/hash.ts CHANGED
@@ -55,7 +55,7 @@ export function computeUniqueNoteHash(noteNonce: Fr, siloedNoteHash: Fr): Promis
55
55
  * @returns A siloed nullifier.
56
56
  */
57
57
  export function siloNullifier(contract: AztecAddress, innerNullifier: Fr): Promise<Fr> {
58
- return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.OUTER_NULLIFIER);
58
+ return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.SILOED_NULLIFIER);
59
59
  }
60
60
 
61
61
  /**
@@ -87,7 +87,7 @@ export function computePublicDataTreeValue(value: Fr): Fr {
87
87
 
88
88
  */
89
89
  export function computePublicDataTreeLeafSlot(contractAddress: AztecAddress, storageSlot: Fr): Promise<Fr> {
90
- return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.PUBLIC_LEAF_INDEX);
90
+ return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.PUBLIC_LEAF_SLOT);
91
91
  }
92
92
 
93
93
  /**
@@ -1,4 +1,5 @@
1
- import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
1
+ import { GeneratorIndex } from '@aztec/constants';
2
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
2
3
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
4
 
4
5
  /**
@@ -14,5 +15,5 @@ export function deriveStorageSlotInMap(
14
15
  toField: () => Fr;
15
16
  },
16
17
  ): Promise<Fr> {
17
- return poseidon2Hash([mapSlot, key.toField()]);
18
+ return poseidon2HashWithSeparator([mapSlot, key.toField()], GeneratorIndex.PUBLIC_STORAGE_MAP_SLOT);
18
19
  }
@@ -4,6 +4,7 @@ import type { ApiSchemaFor } from '@aztec/foundation/schemas';
4
4
 
5
5
  import { z } from 'zod';
6
6
 
7
+ import { BlockHash } from '../block/block_hash.js';
7
8
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
8
9
  import { L2Block } from '../block/l2_block.js';
9
10
  import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
@@ -99,12 +100,12 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
99
100
  .function()
100
101
  .args(CheckpointNumberSchema, schemas.Integer)
101
102
  .returns(z.array(PublishedCheckpoint.schema)),
102
- getCheckpointedBlockByHash: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
103
+ getCheckpointedBlockByHash: z.function().args(BlockHash.schema).returns(CheckpointedL2Block.schema.optional()),
103
104
  getCheckpointedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
104
- getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
105
+ getBlockHeaderByHash: z.function().args(BlockHash.schema).returns(BlockHeader.schema.optional()),
105
106
  getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
106
107
  getL2Block: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
107
- getL2BlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
108
+ getL2BlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
108
109
  getL2BlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
109
110
  getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
110
111
  getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
@@ -52,7 +52,8 @@ export interface AztecNodeAdmin {
52
52
  getSlashOffenses(round: bigint | 'all' | 'current'): Promise<Offense[]>;
53
53
  }
54
54
 
55
- export type AztecNodeAdminConfig = ValidatorClientFullConfig &
55
+ // L1 contracts are not mutable via admin updates.
56
+ export type AztecNodeAdminConfig = Omit<ValidatorClientFullConfig, 'l1Contracts'> &
56
57
  SequencerConfig &
57
58
  ProverConfig &
58
59
  SlasherConfig &
@@ -65,7 +66,7 @@ export type AztecNodeAdminConfig = ValidatorClientFullConfig &
65
66
 
66
67
  export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConfigSchema)
67
68
  .merge(SlasherConfigSchema)
68
- .merge(ValidatorClientFullConfigSchema)
69
+ .merge(ValidatorClientFullConfigSchema.omit({ l1Contracts: true }))
69
70
  .merge(
70
71
  ArchiverSpecificConfigSchema.pick({
71
72
  archiverPollingIntervalMS: true,
@@ -1,10 +1,4 @@
1
- import {
2
- ARCHIVE_HEIGHT,
3
- L1_TO_L2_MSG_TREE_HEIGHT,
4
- NOTE_HASH_TREE_HEIGHT,
5
- NULLIFIER_TREE_HEIGHT,
6
- PUBLIC_DATA_TREE_HEIGHT,
7
- } from '@aztec/constants';
1
+ import { ARCHIVE_HEIGHT, L1_TO_L2_MSG_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
8
2
  import { type L1ContractAddresses, L1ContractAddressesSchema } from '@aztec/ethereum/l1-contract-addresses';
9
3
  import {
10
4
  BlockNumber,
@@ -23,7 +17,7 @@ import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
23
17
  import { z } from 'zod';
24
18
 
25
19
  import type { AztecAddress } from '../aztec-address/index.js';
26
- import { L2BlockHash } from '../block/block_hash.js';
20
+ import { BlockHash } from '../block/block_hash.js';
27
21
  import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
28
22
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
29
23
  import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
@@ -93,63 +87,31 @@ export interface AztecNode
93
87
  /**
94
88
  * Find the indexes of the given leaves in the given tree along with a block metadata pointing to the block in which
95
89
  * the leaves were inserted.
96
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
90
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
97
91
  * @param treeId - The tree to search in.
98
92
  * @param leafValues - The values to search for.
99
93
  * @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
100
94
  */
101
95
  findLeavesIndexes(
102
- block: BlockParameter,
96
+ referenceBlock: BlockParameter,
103
97
  treeId: MerkleTreeId,
104
98
  leafValues: Fr[],
105
99
  ): Promise<(DataInBlock<bigint> | undefined)[]>;
106
100
 
107
- /**
108
- * Returns a sibling path for the given index in the nullifier tree.
109
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
110
- * @param leafIndex - The index of the leaf for which the sibling path is required.
111
- * @returns The sibling path for the leaf index.
112
- */
113
- getNullifierSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof NULLIFIER_TREE_HEIGHT>>;
114
-
115
- /**
116
- * Returns a sibling path for the given index in the note hash tree.
117
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
118
- * @param leafIndex - The index of the leaf for which the sibling path is required.
119
- * @returns The sibling path for the leaf index.
120
- */
121
- getNoteHashSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>>;
122
-
123
- /**
124
- * Returns a sibling path for a leaf in the committed historic blocks tree.
125
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
126
- * @param leafIndex - Index of the leaf in the tree.
127
- * @returns The sibling path.
128
- */
129
- getArchiveSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof ARCHIVE_HEIGHT>>;
130
-
131
- /**
132
- * Returns a sibling path for a leaf in the committed public data tree.
133
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
134
- * @param leafIndex - Index of the leaf in the tree.
135
- * @returns The sibling path.
136
- */
137
- getPublicDataSiblingPath(
138
- block: BlockParameter,
139
- leafIndex: bigint,
140
- ): Promise<SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>>;
141
-
142
101
  /**
143
102
  * Returns a nullifier membership witness for a given nullifier at a given block.
144
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
103
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
145
104
  * @param nullifier - Nullifier we try to find witness for.
146
105
  * @returns The nullifier membership witness (if found).
147
106
  */
148
- getNullifierMembershipWitness(block: BlockParameter, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
107
+ getNullifierMembershipWitness(
108
+ referenceBlock: BlockParameter,
109
+ nullifier: Fr,
110
+ ): Promise<NullifierMembershipWitness | undefined>;
149
111
 
150
112
  /**
151
113
  * Returns a low nullifier membership witness for a given nullifier at a given block.
152
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
114
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
153
115
  * @param nullifier - Nullifier we try to find the low nullifier witness for.
154
116
  * @returns The low nullifier membership witness (if found).
155
117
  * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
@@ -157,49 +119,56 @@ export interface AztecNode
157
119
  * we are trying to prove non-inclusion for.
158
120
  */
159
121
  getLowNullifierMembershipWitness(
160
- block: BlockParameter,
122
+ referenceBlock: BlockParameter,
161
123
  nullifier: Fr,
162
124
  ): Promise<NullifierMembershipWitness | undefined>;
163
125
 
164
126
  /**
165
127
  * Returns a public data tree witness for a given leaf slot at a given block.
166
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
128
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
167
129
  * @param leafSlot - The leaf slot we try to find the witness for.
168
130
  * @returns The public data witness (if found).
169
131
  * @remarks The witness can be used to compute the current value of the public data tree leaf. If the low leaf preimage corresponds to an
170
132
  * "in range" slot, means that the slot doesn't exist and the value is 0. If the low leaf preimage corresponds to the exact slot, the current value
171
133
  * is contained in the leaf preimage.
172
134
  */
173
- getPublicDataWitness(block: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
135
+ getPublicDataWitness(referenceBlock: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
174
136
 
175
137
  /**
176
- * Returns a membership witness for a given archive leaf at a given block.
177
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
178
- * @param archive - The archive leaf we try to find the witness for.
138
+ * Returns a membership witness for a given block hash in the archive tree.
139
+ *
140
+ * Block hashes are the leaves of the archive tree. Each time a new block is added to the chain,
141
+ * its block hash is appended as a new leaf to the archive tree. This method finds the membership
142
+ * witness (leaf index and sibling path) for a given block hash, which can be used to prove that
143
+ * a specific block exists in the chain's history.
144
+ *
145
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data
146
+ * (which contains the root of the archive tree in which we are searching for the block hash).
147
+ * @param blockHash - The block hash to find in the archive tree.
179
148
  */
180
- getArchiveMembershipWitness(
181
- block: BlockParameter,
182
- archive: Fr,
149
+ getBlockHashMembershipWitness(
150
+ referenceBlock: BlockParameter,
151
+ blockHash: BlockHash,
183
152
  ): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined>;
184
153
 
185
154
  /**
186
155
  * Returns a membership witness for a given note hash at a given block.
187
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
156
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
188
157
  * @param noteHash - The note hash we try to find the witness for.
189
158
  */
190
159
  getNoteHashMembershipWitness(
191
- block: BlockParameter,
160
+ referenceBlock: BlockParameter,
192
161
  noteHash: Fr,
193
162
  ): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
194
163
 
195
164
  /**
196
165
  * Returns the index and a sibling path for a leaf in the committed l1 to l2 data tree.
197
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
166
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
198
167
  * @param l1ToL2Message - The l1ToL2Message to get the index / sibling path for.
199
168
  * @returns A tuple of the index and the sibling path of the L1ToL2Message (undefined if not found).
200
169
  */
201
170
  getL1ToL2MessageMembershipWitness(
202
- block: BlockParameter,
171
+ referenceBlock: BlockParameter,
203
172
  l1ToL2Message: Fr,
204
173
  ): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined>;
205
174
 
@@ -224,17 +193,17 @@ export interface AztecNode
224
193
 
225
194
  /**
226
195
  * Get a block specified by its block number or 'latest'.
227
- * @param number - The block number or 'latest'.
196
+ * @param blockParameter - The block parameter (block number, block hash, or 'latest').
228
197
  * @returns The requested block.
229
198
  */
230
- getBlock(number: BlockParameter): Promise<L2Block | undefined>;
199
+ getBlock(blockParameter: BlockParameter): Promise<L2Block | undefined>;
231
200
 
232
201
  /**
233
202
  * Get a block specified by its hash.
234
203
  * @param blockHash - The block hash being requested.
235
204
  * @returns The requested block.
236
205
  */
237
- getBlockByHash(blockHash: Fr): Promise<L2Block | undefined>;
206
+ getBlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
238
207
 
239
208
  /**
240
209
  * Get a block specified by its archive root.
@@ -355,7 +324,7 @@ export interface AztecNode
355
324
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
356
325
  * for a tag, the caller should fetch the next page to check for more logs.
357
326
  */
358
- getPrivateLogsByTags(tags: SiloedTag[], page?: number, referenceBlock?: L2BlockHash): Promise<TxScopedL2Log[][]>;
327
+ getPrivateLogsByTags(tags: SiloedTag[], page?: number, referenceBlock?: BlockHash): Promise<TxScopedL2Log[][]>;
359
328
 
360
329
  /**
361
330
  * Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
@@ -374,7 +343,7 @@ export interface AztecNode
374
343
  contractAddress: AztecAddress,
375
344
  tags: Tag[],
376
345
  page?: number,
377
- referenceBlock?: L2BlockHash,
346
+ referenceBlock?: BlockHash,
378
347
  ): Promise<TxScopedL2Log[][]>;
379
348
 
380
349
  /**
@@ -433,12 +402,12 @@ export interface AztecNode
433
402
  * @remarks The storage slot here refers to the slot as it is defined in Noir not the index in the merkle tree.
434
403
  * Aztec's version of `eth_getStorageAt`.
435
404
  *
436
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
405
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
437
406
  * @param contract - Address of the contract to query.
438
407
  * @param slot - Slot to query.
439
408
  * @returns Storage value at the given contract slot.
440
409
  */
441
- getPublicStorageAt(block: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
410
+ getPublicStorageAt(referenceBlock: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
442
411
 
443
412
  /**
444
413
  * Returns the block header for a given block number, block hash, or 'latest'.
@@ -518,26 +487,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
518
487
  .args(BlockParameterSchema, z.nativeEnum(MerkleTreeId), z.array(schemas.Fr).max(MAX_RPC_LEN))
519
488
  .returns(z.array(optional(dataInBlockSchemaFor(schemas.BigInt)))),
520
489
 
521
- getNullifierSiblingPath: z
522
- .function()
523
- .args(BlockParameterSchema, schemas.BigInt)
524
- .returns(SiblingPath.schemaFor(NULLIFIER_TREE_HEIGHT)),
525
-
526
- getNoteHashSiblingPath: z
527
- .function()
528
- .args(BlockParameterSchema, schemas.BigInt)
529
- .returns(SiblingPath.schemaFor(NOTE_HASH_TREE_HEIGHT)),
530
-
531
- getArchiveSiblingPath: z
532
- .function()
533
- .args(BlockParameterSchema, schemas.BigInt)
534
- .returns(SiblingPath.schemaFor(ARCHIVE_HEIGHT)),
535
-
536
- getPublicDataSiblingPath: z
537
- .function()
538
- .args(BlockParameterSchema, schemas.BigInt)
539
- .returns(SiblingPath.schemaFor(PUBLIC_DATA_TREE_HEIGHT)),
540
-
541
490
  getNullifierMembershipWitness: z
542
491
  .function()
543
492
  .args(BlockParameterSchema, schemas.Fr)
@@ -553,9 +502,9 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
553
502
  .args(BlockParameterSchema, schemas.Fr)
554
503
  .returns(PublicDataWitness.schema.optional()),
555
504
 
556
- getArchiveMembershipWitness: z
505
+ getBlockHashMembershipWitness: z
557
506
  .function()
558
- .args(BlockParameterSchema, schemas.Fr)
507
+ .args(BlockParameterSchema, BlockHash.schema)
559
508
  .returns(MembershipWitness.schemaFor(ARCHIVE_HEIGHT).optional()),
560
509
 
561
510
  getNoteHashMembershipWitness: z
@@ -579,7 +528,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
579
528
 
580
529
  getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
581
530
 
582
- getBlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
531
+ getBlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
583
532
 
584
533
  getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
585
534
 
@@ -633,7 +582,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
633
582
 
634
583
  getPrivateLogsByTags: z
635
584
  .function()
636
- .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)), optional(L2BlockHash.schema))
585
+ .args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)), optional(BlockHash.schema))
637
586
  .returns(z.array(z.array(TxScopedL2Log.schema))),
638
587
 
639
588
  getPublicLogsByTagsFromContract: z
@@ -642,7 +591,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
642
591
  schemas.AztecAddress,
643
592
  z.array(Tag.schema).max(MAX_RPC_LEN),
644
593
  optional(z.number().gte(0)),
645
- optional(L2BlockHash.schema),
594
+ optional(BlockHash.schema),
646
595
  )
647
596
  .returns(z.array(z.array(TxScopedL2Log.schema))),
648
597
 
@@ -1,5 +1,6 @@
1
1
  import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
2
2
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { LoggerBindings } from '@aztec/foundation/log';
3
4
 
4
5
  import type { L2Block } from '../block/l2_block.js';
5
6
  import type { ChainConfig, SequencerConfig } from '../config/chain-config.js';
@@ -61,8 +62,16 @@ export const FullNodeBlockBuilderConfigKeys: (keyof FullNodeBlockBuilderConfig)[
61
62
  'fakeThrowAfterProcessingTxCount',
62
63
  ] as const;
63
64
 
65
+ /** Thrown when no valid transactions are available to include in a block after processing, and this is not the first block in a checkpoint. */
66
+ export class NoValidTxsError extends Error {
67
+ constructor(public readonly failedTxs: FailedTx[]) {
68
+ super('No valid transactions to include in block');
69
+ this.name = 'NoValidTxsError';
70
+ }
71
+ }
72
+
64
73
  /** Result of building a block within a checkpoint. */
65
- export interface BuildBlockInCheckpointResult {
74
+ export type BuildBlockInCheckpointResult = {
66
75
  block: L2Block;
67
76
  publicGas: Gas;
68
77
  publicProcessorDuration: number;
@@ -70,7 +79,7 @@ export interface BuildBlockInCheckpointResult {
70
79
  failedTxs: FailedTx[];
71
80
  usedTxs: Tx[];
72
81
  usedTxBlobFields: number;
73
- }
82
+ };
74
83
 
75
84
  /** Interface for building blocks within a checkpoint context. */
76
85
  export interface ICheckpointBlockBuilder {
@@ -92,5 +101,6 @@ export interface ICheckpointsBuilder {
92
101
  l1ToL2Messages: Fr[],
93
102
  previousCheckpointOutHashes: Fr[],
94
103
  fork: MerkleTreeWriteOperations,
104
+ bindings?: LoggerBindings,
95
105
  ): Promise<ICheckpointBlockBuilder>;
96
106
  }
@@ -1,3 +1,5 @@
1
+ import type { EpochNumber } from '@aztec/foundation/branded-types';
2
+
1
3
  import type { ProvingRequestType } from '../proofs/proving_request_type.js';
2
4
  import type { ProofUri, ProvingJob, ProvingJobId, ProvingJobStatus } from './proving-job.js';
3
5
 
@@ -88,3 +90,23 @@ export interface ProvingJobConsumer {
88
90
  }
89
91
 
90
92
  export interface ProvingJobBroker extends ProvingJobProducer, ProvingJobConsumer {}
93
+
94
+ /**
95
+ * Debug interface for replaying proving jobs from stored inputs.
96
+ * Used for benchmarking different agent configurations against the same workload.
97
+ */
98
+ export interface ProvingJobBrokerDebug {
99
+ /**
100
+ * Replays a proving job by re-enqueuing it with inputs from the configured proof store.
101
+ * The proof type is parsed from the job ID (format: epoch:typeName:hash).
102
+ * @param jobId - The original job ID to replay
103
+ * @param epochNumber - The epoch number to assign
104
+ * @param inputsUri - The proof inputs location
105
+ */
106
+ replayProvingJob(
107
+ jobId: ProvingJobId,
108
+ type: ProvingRequestType,
109
+ epochNumber: EpochNumber,
110
+ inputsUri: ProofUri,
111
+ ): Promise<ProvingJobStatus>;
112
+ }
@@ -35,6 +35,8 @@ export type ProverConfig = ActualProverConfig & {
35
35
  proverId?: EthAddress;
36
36
  /** Number of proving agents to start within the prover. */
37
37
  proverAgentCount: number;
38
+ /** Where to store proving request. Must be accessible to both prover node and agents. If not set will inline-encode the parameters */
39
+ proofStore?: string;
38
40
  /** Store for failed proof inputs. */
39
41
  failedProofStore?: string;
40
42
  };
@@ -48,6 +50,7 @@ export const ProverConfigSchema = zodFor<ProverConfig>()(
48
50
  proverTestDelayMs: z.number(),
49
51
  proverTestDelayFactor: z.number(),
50
52
  proverAgentCount: z.number(),
53
+ proofStore: z.string().optional(),
51
54
  failedProofStore: z.string().optional(),
52
55
  cancelJobsOnStop: z.boolean(),
53
56
  }),
@@ -87,6 +90,10 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
87
90
  description: 'The number of prover agents to start',
88
91
  ...numberConfigHelper(1),
89
92
  },
93
+ proofStore: {
94
+ env: 'PROVER_PROOF_STORE',
95
+ description: 'Optional proof input store for the prover',
96
+ },
90
97
  failedProofStore: {
91
98
  env: 'PROVER_FAILED_PROOF_STORE',
92
99
  description:
@@ -51,8 +51,7 @@ export type ValidatorClientConfig = ValidatorHASignerConfig & {
51
51
  /** Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus */
52
52
  fishermanMode?: boolean;
53
53
 
54
- // TODO(palla/mbps): Change default to false once checkpoint validation is stable
55
- /** Skip checkpoint proposal validation and always attest (default: true) */
54
+ /** Skip checkpoint proposal validation and always attest (default: false) */
56
55
  skipCheckpointProposalValidation?: boolean;
57
56
 
58
57
  /** Skip pushing re-executed blocks to archiver (default: false) */
@@ -10,8 +10,8 @@ import type { KeyPrefix } from './key_types.js';
10
10
  import { PublicKeys } from './public_keys.js';
11
11
  import { getKeyGenerator } from './utils.js';
12
12
 
13
- export function computeAppNullifierSecretKey(masterNullifierSecretKey: GrumpkinScalar, app: AztecAddress): Promise<Fr> {
14
- return computeAppSecretKey(masterNullifierSecretKey, app, 'n'); // 'n' is the key prefix for nullifier secret key
13
+ export function computeAppNullifierHidingKey(masterNullifierHidingKey: GrumpkinScalar, app: AztecAddress): Promise<Fr> {
14
+ return computeAppSecretKey(masterNullifierHidingKey, app, 'n'); // 'n' is the key prefix for nullifier hiding key
15
15
  }
16
16
 
17
17
  export function computeAppSecretKey(skM: GrumpkinScalar, app: AztecAddress, keyPrefix: KeyPrefix): Promise<Fr> {
@@ -26,8 +26,8 @@ export async function computeOvskApp(ovsk: GrumpkinScalar, app: AztecAddress): P
26
26
  return GrumpkinScalar.fromBuffer(ovskAppFr.toBuffer());
27
27
  }
28
28
 
29
- export function deriveMasterNullifierSecretKey(secretKey: Fr): GrumpkinScalar {
30
- return sha512ToGrumpkinScalar([secretKey, GeneratorIndex.NSK_M]);
29
+ export function deriveMasterNullifierHidingKey(secretKey: Fr): GrumpkinScalar {
30
+ return sha512ToGrumpkinScalar([secretKey, GeneratorIndex.NHK_M]);
31
31
  }
32
32
 
33
33
  export function deriveMasterIncomingViewingSecretKey(secretKey: Fr): GrumpkinScalar {
@@ -93,15 +93,15 @@ export function derivePublicKeyFromSecretKey(secretKey: Fq) {
93
93
  * @returns The derived keys.
94
94
  */
95
95
  export async function deriveKeys(secretKey: Fr) {
96
- // First we derive master secret keys - we use sha512 here because this derivation will never take place
96
+ // First we derive master secret/hiding keys - we use sha512 here because this derivation will never take place
97
97
  // in a circuit
98
- const masterNullifierSecretKey = deriveMasterNullifierSecretKey(secretKey);
98
+ const masterNullifierHidingKey = deriveMasterNullifierHidingKey(secretKey);
99
99
  const masterIncomingViewingSecretKey = deriveMasterIncomingViewingSecretKey(secretKey);
100
100
  const masterOutgoingViewingSecretKey = deriveMasterOutgoingViewingSecretKey(secretKey);
101
101
  const masterTaggingSecretKey = sha512ToGrumpkinScalar([secretKey, GeneratorIndex.TSK_M]);
102
102
 
103
103
  // Then we derive master public keys
104
- const masterNullifierPublicKey = await derivePublicKeyFromSecretKey(masterNullifierSecretKey);
104
+ const masterNullifierPublicKey = await derivePublicKeyFromSecretKey(masterNullifierHidingKey);
105
105
  const masterIncomingViewingPublicKey = await derivePublicKeyFromSecretKey(masterIncomingViewingSecretKey);
106
106
  const masterOutgoingViewingPublicKey = await derivePublicKeyFromSecretKey(masterOutgoingViewingSecretKey);
107
107
  const masterTaggingPublicKey = await derivePublicKeyFromSecretKey(masterTaggingSecretKey);
@@ -115,7 +115,7 @@ export async function deriveKeys(secretKey: Fr) {
115
115
  );
116
116
 
117
117
  return {
118
- masterNullifierSecretKey,
118
+ masterNullifierHidingKey,
119
119
  masterIncomingViewingSecretKey,
120
120
  masterOutgoingViewingSecretKey,
121
121
  masterTaggingSecretKey,
@@ -1,5 +1,5 @@
1
1
  import type { GeneratorIndex } from '@aztec/constants';
2
2
 
3
- export type KeyGenerator = GeneratorIndex.NSK_M | GeneratorIndex.IVSK_M | GeneratorIndex.OVSK_M | GeneratorIndex.TSK_M;
3
+ export type KeyGenerator = GeneratorIndex.NHK_M | GeneratorIndex.IVSK_M | GeneratorIndex.OVSK_M | GeneratorIndex.TSK_M;
4
4
  export type KeyPrefix = 'n' | 'iv' | 'ov' | 't';
5
5
  export const KEY_PREFIXES: KeyPrefix[] = ['n', 'iv', 'ov', 't'];
package/src/keys/utils.ts CHANGED
@@ -3,7 +3,11 @@ import { GeneratorIndex } from '@aztec/constants';
3
3
  import type { KeyGenerator, KeyPrefix } from './key_types.js';
4
4
 
5
5
  export function getKeyGenerator(prefix: KeyPrefix): KeyGenerator {
6
- // We get enum key by capitalizing key prefix and concatenating it with 'SK_M'
7
- const enumKey = `${prefix.toUpperCase()}SK_M`;
8
- return GeneratorIndex[enumKey as keyof typeof GeneratorIndex] as KeyGenerator;
6
+ const map: Record<KeyPrefix, KeyGenerator> = {
7
+ n: GeneratorIndex.NHK_M,
8
+ iv: GeneratorIndex.IVSK_M,
9
+ ov: GeneratorIndex.OVSK_M,
10
+ t: GeneratorIndex.TSK_M,
11
+ };
12
+ return map[prefix];
9
13
  }
@@ -41,6 +41,7 @@ export class SlashFactoryContract {
41
41
 
42
42
  return {
43
43
  to: this.contract.address,
44
+ abi: SlashFactoryAbi,
44
45
  data: encodeFunctionData({
45
46
  abi: SlashFactoryAbi,
46
47
  functionName: 'createSlashPayload',