@aztec/stdlib 0.0.1-commit.f295ac2 → 0.0.1-commit.fc805bf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/block/block_hash.d.ts +16 -18
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +21 -31
- package/dest/block/block_parameter.d.ts +4 -4
- package/dest/block/block_parameter.d.ts.map +1 -1
- package/dest/block/block_parameter.js +2 -2
- package/dest/block/checkpointed_l2_block.d.ts +6 -6
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
- package/dest/block/checkpointed_l2_block.js +3 -3
- package/dest/block/in_block.d.ts +11 -11
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/in_block.js +4 -4
- package/dest/block/index.d.ts +2 -2
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -1
- package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +8 -7
- package/dest/block/l2_block.d.ts.map +1 -0
- package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
- package/dest/block/l2_block_source.d.ts +39 -30
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +6 -3
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +37 -25
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +2 -2
- package/dest/checkpoint/checkpoint.d.ts +8 -8
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +4 -4
- package/dest/checkpoint/published_checkpoint.d.ts +2 -2
- package/dest/config/node-rpc-config.js +1 -1
- package/dest/contract/contract_address.js +1 -1
- package/dest/contract/contract_class_id.d.ts +1 -1
- package/dest/contract/contract_class_id.js +1 -1
- package/dest/contract/private_function.d.ts +1 -1
- package/dest/contract/private_function.d.ts.map +1 -1
- package/dest/contract/private_function.js +2 -3
- package/dest/contract/private_function_membership_proof.d.ts +1 -1
- package/dest/contract/private_function_membership_proof.js +1 -1
- package/dest/database-version/database_version.d.ts +58 -0
- package/dest/database-version/database_version.d.ts.map +1 -0
- package/dest/database-version/database_version.js +69 -0
- package/dest/database-version/version_manager.d.ts +2 -50
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +1 -66
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
- package/dest/epoch-helpers/index.d.ts +3 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +5 -1
- package/dest/hash/hash.js +2 -2
- package/dest/hash/map_slot.d.ts +1 -1
- package/dest/hash/map_slot.d.ts.map +1 -1
- package/dest/hash/map_slot.js +4 -3
- package/dest/interfaces/api_limit.d.ts +2 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +1 -0
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +19 -18
- package/dest/interfaces/aztec-node-admin.d.ts +4 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +64 -62
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +13 -17
- package/dest/interfaces/block-builder.d.ts +13 -7
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +7 -0
- package/dest/interfaces/configs.d.ts +2 -2
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/get_logs_response.d.ts +7 -7
- package/dest/interfaces/l2_logs_source.d.ts +14 -5
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +10 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/tx_provider.d.ts +3 -3
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +3 -3
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
- package/dest/keys/derivation.d.ts +3 -3
- package/dest/keys/derivation.js +8 -8
- package/dest/keys/key_types.d.ts +1 -1
- package/dest/keys/utils.d.ts +1 -1
- package/dest/keys/utils.d.ts.map +1 -1
- package/dest/keys/utils.js +7 -3
- package/dest/l1-contracts/slash_factory.d.ts +1 -1
- package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
- package/dest/l1-contracts/slash_factory.js +1 -0
- package/dest/logs/extended_public_log.d.ts +6 -6
- package/dest/logs/log_id.d.ts +8 -8
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +6 -5
- package/dest/logs/siloed_tag.d.ts +1 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +4 -3
- package/dest/p2p/block_proposal.d.ts +13 -6
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +10 -3
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/constants.d.ts +3 -0
- package/dest/p2p/constants.d.ts.map +1 -0
- package/dest/p2p/constants.js +2 -0
- package/dest/p2p/index.d.ts +2 -1
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +1 -0
- package/dest/p2p/message_validator.d.ts +18 -3
- package/dest/p2p/message_validator.d.ts.map +1 -1
- package/dest/p2p/message_validator.js +2 -1
- package/dest/stats/stats.d.ts +1 -3
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.js +1 -1
- package/dest/tests/jest.d.ts +4 -4
- package/dest/tests/jest.js +9 -9
- package/dest/tests/mocks.d.ts +15 -10
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +19 -13
- package/dest/tx/block_header.d.ts +3 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +3 -2
- package/dest/tx/in_tx.d.ts +3 -3
- package/dest/tx/indexed_tx_effect.d.ts +5 -5
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +3 -2
- package/dest/tx/tx.d.ts +2 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +6 -3
- package/dest/tx/tx_receipt.d.ts +42 -14
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +46 -15
- package/dest/tx/validator/error_texts.d.ts +2 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +2 -0
- package/package.json +11 -10
- package/src/block/block_hash.ts +26 -47
- package/src/block/block_parameter.ts +3 -3
- package/src/block/checkpointed_l2_block.ts +4 -4
- package/src/block/in_block.ts +7 -7
- package/src/block/index.ts +1 -1
- package/src/block/{l2_block_new.ts → l2_block.ts} +8 -12
- package/src/block/l2_block_source.ts +40 -31
- package/src/block/l2_block_stream/interfaces.ts +2 -2
- package/src/block/l2_block_stream/l2_block_stream.ts +44 -27
- package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
- package/src/block/test/l2_tips_store_test_suite.ts +4 -4
- package/src/checkpoint/checkpoint.ts +7 -7
- package/src/config/node-rpc-config.ts +1 -1
- package/src/contract/contract_address.ts +1 -1
- package/src/contract/contract_class_id.ts +1 -1
- package/src/contract/private_function.ts +2 -3
- package/src/contract/private_function_membership_proof.ts +1 -1
- package/src/database-version/database_version.ts +87 -0
- package/src/database-version/version_manager.ts +1 -77
- package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
- package/src/epoch-helpers/index.ts +10 -1
- package/src/hash/hash.ts +2 -2
- package/src/hash/map_slot.ts +3 -2
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +19 -27
- package/src/interfaces/aztec-node.ts +89 -120
- package/src/interfaces/block-builder.ts +15 -5
- package/src/interfaces/configs.ts +1 -3
- package/src/interfaces/l2_logs_source.ts +17 -4
- package/src/interfaces/prover-client.ts +15 -0
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/interfaces/validator.ts +2 -4
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
- package/src/keys/derivation.ts +8 -8
- package/src/keys/key_types.ts +1 -1
- package/src/keys/utils.ts +7 -3
- package/src/l1-contracts/slash_factory.ts +1 -0
- package/src/logs/log_id.ts +7 -6
- package/src/logs/siloed_tag.ts +3 -2
- package/src/p2p/block_proposal.ts +12 -5
- package/src/p2p/checkpoint_proposal.ts +9 -2
- package/src/p2p/constants.ts +3 -0
- package/src/p2p/index.ts +1 -0
- package/src/p2p/message_validator.ts +14 -2
- package/src/stats/stats.ts +0 -2
- package/src/tests/factories.ts +1 -1
- package/src/tests/jest.ts +9 -9
- package/src/tests/mocks.ts +26 -17
- package/src/tx/block_header.ts +7 -4
- package/src/tx/indexed_tx_effect.ts +3 -2
- package/src/tx/tx.ts +8 -9
- package/src/tx/tx_receipt.ts +75 -18
- package/src/tx/validator/error_texts.ts +3 -0
- package/dest/block/l2_block_new.d.ts.map +0 -1
- package/dest/database-version/index.d.ts +0 -2
- package/dest/database-version/index.d.ts.map +0 -1
- package/dest/database-version/index.js +0 -1
- package/src/database-version/index.ts +0 -1
|
@@ -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,10 +17,11 @@ 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';
|
|
20
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
26
21
|
import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
|
|
27
22
|
import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
|
|
28
23
|
import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
|
|
29
|
-
import {
|
|
24
|
+
import { L2Block } from '../block/l2_block.js';
|
|
30
25
|
import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
31
26
|
import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
32
27
|
import {
|
|
@@ -77,13 +72,7 @@ import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_s
|
|
|
77
72
|
export interface AztecNode
|
|
78
73
|
extends Pick<
|
|
79
74
|
L2BlockSource,
|
|
80
|
-
| '
|
|
81
|
-
| 'getL2BlocksNew'
|
|
82
|
-
| 'getPublishedBlocks'
|
|
83
|
-
| 'getPublishedCheckpoints'
|
|
84
|
-
| 'getBlockHeader'
|
|
85
|
-
| 'getL2Tips'
|
|
86
|
-
| 'getCheckpointedBlocks'
|
|
75
|
+
'getBlocks' | 'getCheckpoints' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpointedBlocks'
|
|
87
76
|
> {
|
|
88
77
|
/**
|
|
89
78
|
* Returns the tips of the L2 chain.
|
|
@@ -98,63 +87,31 @@ export interface AztecNode
|
|
|
98
87
|
/**
|
|
99
88
|
* Find the indexes of the given leaves in the given tree along with a block metadata pointing to the block in which
|
|
100
89
|
* the leaves were inserted.
|
|
101
|
-
* @param
|
|
90
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
102
91
|
* @param treeId - The tree to search in.
|
|
103
92
|
* @param leafValues - The values to search for.
|
|
104
93
|
* @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
|
|
105
94
|
*/
|
|
106
95
|
findLeavesIndexes(
|
|
107
|
-
|
|
96
|
+
referenceBlock: BlockParameter,
|
|
108
97
|
treeId: MerkleTreeId,
|
|
109
98
|
leafValues: Fr[],
|
|
110
99
|
): Promise<(DataInBlock<bigint> | undefined)[]>;
|
|
111
100
|
|
|
112
|
-
/**
|
|
113
|
-
* Returns a sibling path for the given index in the nullifier tree.
|
|
114
|
-
* @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
115
|
-
* @param leafIndex - The index of the leaf for which the sibling path is required.
|
|
116
|
-
* @returns The sibling path for the leaf index.
|
|
117
|
-
*/
|
|
118
|
-
getNullifierSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof NULLIFIER_TREE_HEIGHT>>;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Returns a sibling path for the given index in the note hash tree.
|
|
122
|
-
* @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
123
|
-
* @param leafIndex - The index of the leaf for which the sibling path is required.
|
|
124
|
-
* @returns The sibling path for the leaf index.
|
|
125
|
-
*/
|
|
126
|
-
getNoteHashSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>>;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Returns a sibling path for a leaf in the committed historic blocks tree.
|
|
130
|
-
* @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
131
|
-
* @param leafIndex - Index of the leaf in the tree.
|
|
132
|
-
* @returns The sibling path.
|
|
133
|
-
*/
|
|
134
|
-
getArchiveSiblingPath(block: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof ARCHIVE_HEIGHT>>;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Returns a sibling path for a leaf in the committed public data tree.
|
|
138
|
-
* @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
139
|
-
* @param leafIndex - Index of the leaf in the tree.
|
|
140
|
-
* @returns The sibling path.
|
|
141
|
-
*/
|
|
142
|
-
getPublicDataSiblingPath(
|
|
143
|
-
block: BlockParameter,
|
|
144
|
-
leafIndex: bigint,
|
|
145
|
-
): Promise<SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>>;
|
|
146
|
-
|
|
147
101
|
/**
|
|
148
102
|
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
149
|
-
* @param
|
|
103
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
150
104
|
* @param nullifier - Nullifier we try to find witness for.
|
|
151
105
|
* @returns The nullifier membership witness (if found).
|
|
152
106
|
*/
|
|
153
|
-
getNullifierMembershipWitness(
|
|
107
|
+
getNullifierMembershipWitness(
|
|
108
|
+
referenceBlock: BlockParameter,
|
|
109
|
+
nullifier: Fr,
|
|
110
|
+
): Promise<NullifierMembershipWitness | undefined>;
|
|
154
111
|
|
|
155
112
|
/**
|
|
156
113
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
157
|
-
* @param
|
|
114
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
158
115
|
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
159
116
|
* @returns The low nullifier membership witness (if found).
|
|
160
117
|
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
@@ -162,49 +119,56 @@ export interface AztecNode
|
|
|
162
119
|
* we are trying to prove non-inclusion for.
|
|
163
120
|
*/
|
|
164
121
|
getLowNullifierMembershipWitness(
|
|
165
|
-
|
|
122
|
+
referenceBlock: BlockParameter,
|
|
166
123
|
nullifier: Fr,
|
|
167
124
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
168
125
|
|
|
169
126
|
/**
|
|
170
127
|
* Returns a public data tree witness for a given leaf slot at a given block.
|
|
171
|
-
* @param
|
|
128
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
172
129
|
* @param leafSlot - The leaf slot we try to find the witness for.
|
|
173
130
|
* @returns The public data witness (if found).
|
|
174
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
|
|
175
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
|
|
176
133
|
* is contained in the leaf preimage.
|
|
177
134
|
*/
|
|
178
|
-
getPublicDataWitness(
|
|
135
|
+
getPublicDataWitness(referenceBlock: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
179
136
|
|
|
180
137
|
/**
|
|
181
|
-
* Returns a membership witness for a given
|
|
182
|
-
*
|
|
183
|
-
*
|
|
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.
|
|
184
148
|
*/
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
149
|
+
getBlockHashMembershipWitness(
|
|
150
|
+
referenceBlock: BlockParameter,
|
|
151
|
+
blockHash: BlockHash,
|
|
188
152
|
): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined>;
|
|
189
153
|
|
|
190
154
|
/**
|
|
191
155
|
* Returns a membership witness for a given note hash at a given block.
|
|
192
|
-
* @param
|
|
156
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
193
157
|
* @param noteHash - The note hash we try to find the witness for.
|
|
194
158
|
*/
|
|
195
159
|
getNoteHashMembershipWitness(
|
|
196
|
-
|
|
160
|
+
referenceBlock: BlockParameter,
|
|
197
161
|
noteHash: Fr,
|
|
198
162
|
): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
|
|
199
163
|
|
|
200
164
|
/**
|
|
201
165
|
* Returns the index and a sibling path for a leaf in the committed l1 to l2 data tree.
|
|
202
|
-
* @param
|
|
166
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
203
167
|
* @param l1ToL2Message - The l1ToL2Message to get the index / sibling path for.
|
|
204
168
|
* @returns A tuple of the index and the sibling path of the L1ToL2Message (undefined if not found).
|
|
205
169
|
*/
|
|
206
170
|
getL1ToL2MessageMembershipWitness(
|
|
207
|
-
|
|
171
|
+
referenceBlock: BlockParameter,
|
|
208
172
|
l1ToL2Message: Fr,
|
|
209
173
|
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined>;
|
|
210
174
|
|
|
@@ -229,24 +193,24 @@ export interface AztecNode
|
|
|
229
193
|
|
|
230
194
|
/**
|
|
231
195
|
* Get a block specified by its block number or 'latest'.
|
|
232
|
-
* @param
|
|
196
|
+
* @param blockParameter - The block parameter (block number, block hash, or 'latest').
|
|
233
197
|
* @returns The requested block.
|
|
234
198
|
*/
|
|
235
|
-
getBlock(
|
|
199
|
+
getBlock(blockParameter: BlockParameter): Promise<L2Block | undefined>;
|
|
236
200
|
|
|
237
201
|
/**
|
|
238
202
|
* Get a block specified by its hash.
|
|
239
203
|
* @param blockHash - The block hash being requested.
|
|
240
204
|
* @returns The requested block.
|
|
241
205
|
*/
|
|
242
|
-
getBlockByHash(blockHash:
|
|
206
|
+
getBlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
|
|
243
207
|
|
|
244
208
|
/**
|
|
245
209
|
* Get a block specified by its archive root.
|
|
246
210
|
* @param archive - The archive root being requested.
|
|
247
211
|
* @returns The requested block.
|
|
248
212
|
*/
|
|
249
|
-
getBlockByArchive(archive: Fr): Promise<
|
|
213
|
+
getBlockByArchive(archive: Fr): Promise<L2Block | undefined>;
|
|
250
214
|
|
|
251
215
|
/**
|
|
252
216
|
* Method to fetch the latest block number synchronized by the node.
|
|
@@ -260,6 +224,12 @@ export interface AztecNode
|
|
|
260
224
|
*/
|
|
261
225
|
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
262
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Fetches the latest checkpointed block number.
|
|
229
|
+
* @returns The block number.
|
|
230
|
+
*/
|
|
231
|
+
getCheckpointedBlockNumber(): Promise<BlockNumber>;
|
|
232
|
+
|
|
263
233
|
/**
|
|
264
234
|
* Method to determine if the node is ready to accept transactions.
|
|
265
235
|
* @returns - Flag indicating the readiness for tx submission.
|
|
@@ -279,7 +249,7 @@ export interface AztecNode
|
|
|
279
249
|
* @param limit - The maximum number of blocks to return.
|
|
280
250
|
* @returns The blocks requested.
|
|
281
251
|
*/
|
|
282
|
-
getBlocks(from: BlockNumber, limit: number): Promise<
|
|
252
|
+
getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
|
|
283
253
|
|
|
284
254
|
/**
|
|
285
255
|
* Method to fetch the current min fees.
|
|
@@ -343,16 +313,38 @@ export interface AztecNode
|
|
|
343
313
|
getContractClassLogs(filter: LogFilter): Promise<GetContractClassLogsResponse>;
|
|
344
314
|
|
|
345
315
|
/**
|
|
346
|
-
* Gets
|
|
316
|
+
* Gets private logs that match any of the `tags`. For each tag, an array of matching logs is returned. An empty
|
|
347
317
|
* array implies no logs match that tag.
|
|
318
|
+
* @param tags - The tags to search for.
|
|
319
|
+
* @param page - The page number (0-indexed) for pagination.
|
|
320
|
+
* @param referenceBlock - Optional block hash used to ensure the block still exists before logs are retrieved.
|
|
321
|
+
* This block is expected to represent the latest block to which the client has synced (called anchor block in PXE).
|
|
322
|
+
* If specified and the block is not found, an error is thrown. This helps detect reorgs, which could result in
|
|
323
|
+
* undefined behavior in the client's code.
|
|
324
|
+
* @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
|
|
325
|
+
* for a tag, the caller should fetch the next page to check for more logs.
|
|
348
326
|
*/
|
|
349
|
-
getPrivateLogsByTags(tags: SiloedTag[]): Promise<TxScopedL2Log[][]>;
|
|
327
|
+
getPrivateLogsByTags(tags: SiloedTag[], page?: number, referenceBlock?: BlockHash): Promise<TxScopedL2Log[][]>;
|
|
350
328
|
|
|
351
329
|
/**
|
|
352
|
-
* Gets
|
|
330
|
+
* Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
|
|
353
331
|
* logs is returned. An empty array implies no logs match that tag.
|
|
354
|
-
|
|
355
|
-
|
|
332
|
+
* @param contractAddress - The contract address to search logs for.
|
|
333
|
+
* @param tags - The tags to search for.
|
|
334
|
+
* @param page - The page number (0-indexed) for pagination.
|
|
335
|
+
* @param referenceBlock - Optional block hash used to ensure the block still exists before logs are retrieved.
|
|
336
|
+
* This block is expected to represent the latest block to which the client has synced (called anchor block in PXE).
|
|
337
|
+
* If specified and the block is not found, an error is thrown. This helps detect reorgs, which could result in
|
|
338
|
+
* undefined behavior in the client's code.
|
|
339
|
+
* @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
|
|
340
|
+
* for a tag, the caller should fetch the next page to check for more logs.
|
|
341
|
+
*/
|
|
342
|
+
getPublicLogsByTagsFromContract(
|
|
343
|
+
contractAddress: AztecAddress,
|
|
344
|
+
tags: Tag[],
|
|
345
|
+
page?: number,
|
|
346
|
+
referenceBlock?: BlockHash,
|
|
347
|
+
): Promise<TxScopedL2Log[][]>;
|
|
356
348
|
|
|
357
349
|
/**
|
|
358
350
|
* Method to submit a transaction to the p2p pool.
|
|
@@ -410,12 +402,12 @@ export interface AztecNode
|
|
|
410
402
|
* @remarks The storage slot here refers to the slot as it is defined in Noir not the index in the merkle tree.
|
|
411
403
|
* Aztec's version of `eth_getStorageAt`.
|
|
412
404
|
*
|
|
413
|
-
* @param
|
|
405
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
414
406
|
* @param contract - Address of the contract to query.
|
|
415
407
|
* @param slot - Slot to query.
|
|
416
408
|
* @returns Storage value at the given contract slot.
|
|
417
409
|
*/
|
|
418
|
-
getPublicStorageAt(
|
|
410
|
+
getPublicStorageAt(referenceBlock: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
419
411
|
|
|
420
412
|
/**
|
|
421
413
|
* Returns the block header for a given block number, block hash, or 'latest'.
|
|
@@ -495,26 +487,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
495
487
|
.args(BlockParameterSchema, z.nativeEnum(MerkleTreeId), z.array(schemas.Fr).max(MAX_RPC_LEN))
|
|
496
488
|
.returns(z.array(optional(dataInBlockSchemaFor(schemas.BigInt)))),
|
|
497
489
|
|
|
498
|
-
getNullifierSiblingPath: z
|
|
499
|
-
.function()
|
|
500
|
-
.args(BlockParameterSchema, schemas.BigInt)
|
|
501
|
-
.returns(SiblingPath.schemaFor(NULLIFIER_TREE_HEIGHT)),
|
|
502
|
-
|
|
503
|
-
getNoteHashSiblingPath: z
|
|
504
|
-
.function()
|
|
505
|
-
.args(BlockParameterSchema, schemas.BigInt)
|
|
506
|
-
.returns(SiblingPath.schemaFor(NOTE_HASH_TREE_HEIGHT)),
|
|
507
|
-
|
|
508
|
-
getArchiveSiblingPath: z
|
|
509
|
-
.function()
|
|
510
|
-
.args(BlockParameterSchema, schemas.BigInt)
|
|
511
|
-
.returns(SiblingPath.schemaFor(ARCHIVE_HEIGHT)),
|
|
512
|
-
|
|
513
|
-
getPublicDataSiblingPath: z
|
|
514
|
-
.function()
|
|
515
|
-
.args(BlockParameterSchema, schemas.BigInt)
|
|
516
|
-
.returns(SiblingPath.schemaFor(PUBLIC_DATA_TREE_HEIGHT)),
|
|
517
|
-
|
|
518
490
|
getNullifierMembershipWitness: z
|
|
519
491
|
.function()
|
|
520
492
|
.args(BlockParameterSchema, schemas.Fr)
|
|
@@ -530,9 +502,9 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
530
502
|
.args(BlockParameterSchema, schemas.Fr)
|
|
531
503
|
.returns(PublicDataWitness.schema.optional()),
|
|
532
504
|
|
|
533
|
-
|
|
505
|
+
getBlockHashMembershipWitness: z
|
|
534
506
|
.function()
|
|
535
|
-
.args(BlockParameterSchema,
|
|
507
|
+
.args(BlockParameterSchema, BlockHash.schema)
|
|
536
508
|
.returns(MembershipWitness.schemaFor(ARCHIVE_HEIGHT).optional()),
|
|
537
509
|
|
|
538
510
|
getNoteHashMembershipWitness: z
|
|
@@ -554,16 +526,18 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
554
526
|
.args(EpochNumberSchema)
|
|
555
527
|
.returns(z.array(z.array(z.array(z.array(schemas.Fr))))),
|
|
556
528
|
|
|
557
|
-
getBlock: z.function().args(BlockParameterSchema).returns(
|
|
529
|
+
getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
|
|
558
530
|
|
|
559
|
-
getBlockByHash: z.function().args(
|
|
531
|
+
getBlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
|
|
560
532
|
|
|
561
|
-
getBlockByArchive: z.function().args(schemas.Fr).returns(
|
|
533
|
+
getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
562
534
|
|
|
563
535
|
getBlockNumber: z.function().returns(BlockNumberSchema),
|
|
564
536
|
|
|
565
537
|
getProvenBlockNumber: z.function().returns(BlockNumberSchema),
|
|
566
538
|
|
|
539
|
+
getCheckpointedBlockNumber: z.function().returns(BlockNumberSchema),
|
|
540
|
+
|
|
567
541
|
isReady: z.function().returns(z.boolean()),
|
|
568
542
|
|
|
569
543
|
getNodeInfo: z.function().returns(NodeInfoSchema),
|
|
@@ -571,26 +545,16 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
571
545
|
getBlocks: z
|
|
572
546
|
.function()
|
|
573
547
|
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
574
|
-
.returns(z.array(
|
|
548
|
+
.returns(z.array(L2Block.schema)),
|
|
575
549
|
|
|
576
|
-
|
|
577
|
-
.function()
|
|
578
|
-
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
579
|
-
.returns(z.array(CheckpointedL2Block.schema)),
|
|
580
|
-
|
|
581
|
-
getPublishedCheckpoints: z
|
|
550
|
+
getCheckpoints: z
|
|
582
551
|
.function()
|
|
583
552
|
.args(CheckpointNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN))
|
|
584
553
|
.returns(z.array(PublishedCheckpoint.schema)),
|
|
585
554
|
|
|
586
|
-
getL2BlocksNew: z
|
|
587
|
-
.function()
|
|
588
|
-
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
589
|
-
.returns(z.array(L2BlockNew.schema)),
|
|
590
|
-
|
|
591
555
|
getCheckpointedBlocks: z
|
|
592
556
|
.function()
|
|
593
|
-
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN)
|
|
557
|
+
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
594
558
|
.returns(z.array(CheckpointedL2Block.schema)),
|
|
595
559
|
|
|
596
560
|
getCurrentMinFees: z.function().returns(GasFees.schema),
|
|
@@ -618,12 +582,17 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
618
582
|
|
|
619
583
|
getPrivateLogsByTags: z
|
|
620
584
|
.function()
|
|
621
|
-
.args(z.array(SiloedTag.schema).max(MAX_RPC_LEN))
|
|
585
|
+
.args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)), optional(BlockHash.schema))
|
|
622
586
|
.returns(z.array(z.array(TxScopedL2Log.schema))),
|
|
623
587
|
|
|
624
588
|
getPublicLogsByTagsFromContract: z
|
|
625
589
|
.function()
|
|
626
|
-
.args(
|
|
590
|
+
.args(
|
|
591
|
+
schemas.AztecAddress,
|
|
592
|
+
z.array(Tag.schema).max(MAX_RPC_LEN),
|
|
593
|
+
optional(z.number().gte(0)),
|
|
594
|
+
optional(BlockHash.schema),
|
|
595
|
+
)
|
|
627
596
|
.returns(z.array(z.array(TxScopedL2Log.schema))),
|
|
628
597
|
|
|
629
598
|
sendTx: z.function().args(Tx.schema).returns(z.void()),
|
|
@@ -1,7 +1,8 @@
|
|
|
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
|
-
import type {
|
|
5
|
+
import type { L2Block } from '../block/l2_block.js';
|
|
5
6
|
import type { ChainConfig, SequencerConfig } from '../config/chain-config.js';
|
|
6
7
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
7
8
|
import type { Gas } from '../gas/gas.js';
|
|
@@ -31,7 +32,7 @@ export interface IBlockFactory extends ProcessedTxHandler {
|
|
|
31
32
|
/**
|
|
32
33
|
* Assembles the block and updates the archive tree.
|
|
33
34
|
*/
|
|
34
|
-
setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<
|
|
35
|
+
setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2Block>;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export interface PublicProcessorLimits {
|
|
@@ -61,16 +62,24 @@ 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
|
|
66
|
-
block:
|
|
74
|
+
export type BuildBlockInCheckpointResult = {
|
|
75
|
+
block: L2Block;
|
|
67
76
|
publicGas: Gas;
|
|
68
77
|
publicProcessorDuration: number;
|
|
69
78
|
numTxs: number;
|
|
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
|
}
|
|
@@ -67,9 +67,7 @@ export interface SequencerConfig {
|
|
|
67
67
|
blockDurationMs?: number;
|
|
68
68
|
/** Have sequencer build and publish an empty checkpoint if there are no txs */
|
|
69
69
|
buildCheckpointIfEmpty?: boolean;
|
|
70
|
-
|
|
71
|
-
// TODO(palla/mbps): Change default to false once block sync is stable
|
|
72
|
-
/** Skip pushing proposed blocks to archiver (default: true) */
|
|
70
|
+
/** Skip pushing proposed blocks to archiver (default: false) */
|
|
73
71
|
skipPushProposedBlocksToArchiver?: boolean;
|
|
74
72
|
}
|
|
75
73
|
|
|
@@ -12,16 +12,29 @@ import type { GetContractClassLogsResponse, GetPublicLogsResponse } from './get_
|
|
|
12
12
|
*/
|
|
13
13
|
export interface L2LogsSource {
|
|
14
14
|
/**
|
|
15
|
-
* Gets
|
|
15
|
+
* Gets private logs that match any of the `tags`. For each tag, an array of matching logs is returned. An empty
|
|
16
16
|
* array implies no logs match that tag.
|
|
17
|
+
* @param tags - The tags to search for.
|
|
18
|
+
* @param page - The page number (0-indexed) for pagination.
|
|
19
|
+
* @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
|
|
20
|
+
* for a tag, the caller should fetch the next page to check for more logs.
|
|
17
21
|
*/
|
|
18
|
-
getPrivateLogsByTags(tags: SiloedTag[]): Promise<TxScopedL2Log[][]>;
|
|
22
|
+
getPrivateLogsByTags(tags: SiloedTag[], page?: number): Promise<TxScopedL2Log[][]>;
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
|
-
* Gets
|
|
25
|
+
* Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
|
|
22
26
|
* logs is returned. An empty array implies no logs match that tag.
|
|
27
|
+
* @param contractAddress - The contract address to search logs for.
|
|
28
|
+
* @param tags - The tags to search for.
|
|
29
|
+
* @param page - The page number (0-indexed) for pagination.
|
|
30
|
+
* @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
|
|
31
|
+
* for a tag, the caller should fetch the next page to check for more logs.
|
|
23
32
|
*/
|
|
24
|
-
getPublicLogsByTagsFromContract(
|
|
33
|
+
getPublicLogsByTagsFromContract(
|
|
34
|
+
contractAddress: AztecAddress,
|
|
35
|
+
tags: Tag[],
|
|
36
|
+
page?: number,
|
|
37
|
+
): Promise<TxScopedL2Log[][]>;
|
|
25
38
|
|
|
26
39
|
/**
|
|
27
40
|
* Gets public logs based on the provided filter.
|
|
@@ -17,6 +17,12 @@ export type ActualProverConfig = {
|
|
|
17
17
|
proverTestDelayMs: number;
|
|
18
18
|
/** If using realistic delays, what percentage of realistic times to apply. */
|
|
19
19
|
proverTestDelayFactor: number;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to abort pending proving jobs when the orchestrator is cancelled.
|
|
22
|
+
* When false (default), jobs remain in the broker queue and can be reused on restart/reorg.
|
|
23
|
+
* When true, jobs are explicitly cancelled with the broker, which prevents reuse.
|
|
24
|
+
*/
|
|
25
|
+
cancelJobsOnStop: boolean;
|
|
20
26
|
};
|
|
21
27
|
|
|
22
28
|
/**
|
|
@@ -43,6 +49,7 @@ export const ProverConfigSchema = zodFor<ProverConfig>()(
|
|
|
43
49
|
proverTestDelayFactor: z.number(),
|
|
44
50
|
proverAgentCount: z.number(),
|
|
45
51
|
failedProofStore: z.string().optional(),
|
|
52
|
+
cancelJobsOnStop: z.boolean(),
|
|
46
53
|
}),
|
|
47
54
|
);
|
|
48
55
|
|
|
@@ -85,6 +92,14 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
|
|
|
85
92
|
description:
|
|
86
93
|
'Store for failed proof inputs. Google cloud storage is only supported at the moment. Set this value as gs://bucket-name/path/to/store.',
|
|
87
94
|
},
|
|
95
|
+
cancelJobsOnStop: {
|
|
96
|
+
env: 'PROVER_CANCEL_JOBS_ON_STOP',
|
|
97
|
+
description:
|
|
98
|
+
'Whether to abort pending proving jobs when the orchestrator is cancelled. ' +
|
|
99
|
+
'When false (default), jobs remain in the broker queue and can be reused on restart/reorg. ' +
|
|
100
|
+
'When true, jobs are explicitly cancelled with the broker, which prevents reuse.',
|
|
101
|
+
...booleanConfigHelper(false),
|
|
102
|
+
},
|
|
88
103
|
};
|
|
89
104
|
|
|
90
105
|
function parseProverId(str?: string) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
2
2
|
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
3
3
|
import { type Tx, TxHash } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
@@ -13,5 +13,5 @@ export interface ITxProvider {
|
|
|
13
13
|
opts: { pinnedPeer: PeerId | undefined; deadline: Date },
|
|
14
14
|
): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
|
|
15
15
|
|
|
16
|
-
getTxsForBlock(block:
|
|
16
|
+
getTxsForBlock(block: L2Block, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
|
|
17
17
|
}
|
|
@@ -51,12 +51,10 @@ 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
|
-
|
|
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
|
-
|
|
59
|
-
/** Skip pushing re-executed blocks to archiver (default: true) */
|
|
57
|
+
/** Skip pushing re-executed blocks to archiver (default: false) */
|
|
60
58
|
skipPushProposedBlocksToArchiver?: boolean;
|
|
61
59
|
};
|
|
62
60
|
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
7
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
8
8
|
|
|
9
|
-
import { siloNullifier } from '../../hash/hash.js';
|
|
10
9
|
import type { NullifierLeafPreimage } from '../../trees/nullifier_leaf.js';
|
|
11
10
|
import type { ClaimedLengthArray } from '../claimed_length_array.js';
|
|
12
11
|
import type { ScopedNullifier } from '../nullifier.js';
|
|
@@ -74,7 +73,6 @@ export async function buildNullifierReadRequestHintsFromResetActions<PENDING ext
|
|
|
74
73
|
resetActions: ReadRequestResetActions<typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
|
|
75
74
|
maxPending: PENDING = MAX_NULLIFIER_READ_REQUESTS_PER_TX as PENDING,
|
|
76
75
|
maxSettled: SETTLED = MAX_NULLIFIER_READ_REQUESTS_PER_TX as SETTLED,
|
|
77
|
-
siloed = false,
|
|
78
76
|
) {
|
|
79
77
|
const builder = new NullifierReadRequestHintsBuilder(maxPending, maxSettled);
|
|
80
78
|
|
|
@@ -90,12 +88,7 @@ export async function buildNullifierReadRequestHintsFromResetActions<PENDING ext
|
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
90
|
|
|
93
|
-
|
|
94
|
-
const siloedValues = siloed
|
|
95
|
-
? settledRequests.map(({ readRequest }) => readRequest.value)
|
|
96
|
-
: await Promise.all(
|
|
97
|
-
settledRequests.map(({ readRequest }) => siloNullifier(readRequest.contractAddress, readRequest.value)),
|
|
98
|
-
);
|
|
91
|
+
const siloedValues = settledRequests.map(({ readRequest }) => readRequest.value);
|
|
99
92
|
|
|
100
93
|
// Fetch all membership witnesses in parallel
|
|
101
94
|
const membershipWitnesses = await Promise.all(siloedValues.map(value => oracle.getNullifierMembershipWitness(value)));
|
|
@@ -121,7 +114,6 @@ export async function buildNullifierReadRequestHints<PENDING extends number, SET
|
|
|
121
114
|
futureNullifiers: ScopedNullifier[],
|
|
122
115
|
maxPending: PENDING = MAX_NULLIFIER_READ_REQUESTS_PER_TX as PENDING,
|
|
123
116
|
maxSettled: SETTLED = MAX_NULLIFIER_READ_REQUESTS_PER_TX as SETTLED,
|
|
124
|
-
siloed = false,
|
|
125
117
|
) {
|
|
126
118
|
const resetActions = getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers, futureNullifiers);
|
|
127
119
|
return await buildNullifierReadRequestHintsFromResetActions(
|
|
@@ -130,6 +122,5 @@ export async function buildNullifierReadRequestHints<PENDING extends number, SET
|
|
|
130
122
|
resetActions,
|
|
131
123
|
maxPending,
|
|
132
124
|
maxSettled,
|
|
133
|
-
siloed,
|
|
134
125
|
);
|
|
135
126
|
}
|
package/src/keys/derivation.ts
CHANGED
|
@@ -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
|
|
14
|
-
return computeAppSecretKey(
|
|
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
|
|
30
|
-
return sha512ToGrumpkinScalar([secretKey, GeneratorIndex.
|
|
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
|
|
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(
|
|
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
|
-
|
|
118
|
+
masterNullifierHidingKey,
|
|
119
119
|
masterIncomingViewingSecretKey,
|
|
120
120
|
masterOutgoingViewingSecretKey,
|
|
121
121
|
masterTaggingSecretKey,
|