@aztec/stdlib 3.0.0-nightly.20251203 → 3.0.0-nightly.20251205
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/avm/avm.d.ts +17 -9
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.d.ts +5 -3
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_proving_request.d.ts +9 -5
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/block_parameter.d.ts +5 -0
- package/dest/block/block_parameter.d.ts.map +1 -0
- package/dest/block/block_parameter.js +6 -0
- package/dest/block/in_block.d.ts +6 -5
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/in_block.js +3 -3
- package/dest/block/index.d.ts +1 -1
- package/dest/block/index.js +1 -1
- package/dest/block/l2_block.d.ts +5 -5
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +1 -1
- package/dest/block/l2_block_code_to_purge.js +3 -3
- package/dest/block/l2_block_header.d.ts +3 -3
- package/dest/block/l2_block_header.d.ts.map +1 -1
- package/dest/block/l2_block_info.d.ts +15 -10
- package/dest/block/l2_block_info.d.ts.map +1 -1
- package/dest/block/l2_block_info.js +7 -6
- package/dest/block/l2_block_new.d.ts +5 -4
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +1 -1
- package/dest/block/l2_block_source.d.ts +47 -97
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +5 -11
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +4 -3
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +3 -2
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +4 -2
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +6 -4
- package/dest/checkpoint/checkpoint.d.ts +1 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +2 -2
- package/dest/contract/interfaces/contract_data_source.d.ts +3 -2
- package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +9 -9
- package/dest/interfaces/aztec-node.d.ts +23 -23
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +24 -23
- package/dest/interfaces/block-builder.d.ts +3 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/epoch-prover.d.ts +4 -4
- package/dest/interfaces/epoch-prover.d.ts.map +1 -1
- package/dest/interfaces/get_logs_response.d.ts +5 -3
- package/dest/interfaces/get_logs_response.d.ts.map +1 -1
- package/dest/interfaces/l2_logs_source.d.ts +4 -3
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +3 -2
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +9 -5
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/world_state.d.ts +9 -26
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/interfaces/world_state.js +4 -3
- package/dest/logs/extended_public_log.d.ts +5 -3
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +8 -5
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +5 -4
- package/dest/logs/tx_scoped_l2_log.d.ts +10 -7
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +4 -3
- package/dest/messaging/l1_to_l2_message_source.d.ts +4 -4
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +4 -3
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/note/note_dao.d.ts +4 -3
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +3 -2
- package/dest/tests/factories.js +5 -5
- package/dest/tests/mocks.d.ts +1 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +2 -1
- package/dest/tx/block_header.d.ts +4 -4
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/global_variables.d.ts +13 -11
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +6 -6
- package/dest/tx/indexed_tx_effect.d.ts +6 -3
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +2 -1
- package/dest/tx/private_execution_result.d.ts +3 -3
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/tx_receipt.d.ts +4 -3
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +2 -1
- package/package.json +9 -9
- package/src/block/block_parameter.ts +8 -0
- package/src/block/in_block.ts +5 -4
- package/src/block/index.ts +1 -1
- package/src/block/l2_block.ts +4 -4
- package/src/block/l2_block_code_to_purge.ts +3 -3
- package/src/block/l2_block_info.ts +10 -9
- package/src/block/l2_block_new.ts +4 -3
- package/src/block/l2_block_source.ts +15 -22
- package/src/block/l2_block_stream/l2_block_stream.ts +10 -5
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +5 -2
- package/src/block/test/l2_tips_store_test_suite.ts +8 -3
- package/src/checkpoint/checkpoint.ts +2 -2
- package/src/contract/interfaces/contract_data_source.ts +2 -1
- package/src/interfaces/archiver.ts +9 -9
- package/src/interfaces/aztec-node.ts +51 -44
- package/src/interfaces/block-builder.ts +2 -1
- package/src/interfaces/epoch-prover.ts +3 -3
- package/src/interfaces/l2_logs_source.ts +3 -2
- package/src/interfaces/merkle_tree_operations.ts +2 -1
- package/src/interfaces/world_state.ts +12 -11
- package/src/logs/log_id.ts +6 -5
- package/src/logs/tx_scoped_l2_log.ts +5 -4
- package/src/messaging/l1_to_l2_message_source.ts +3 -3
- package/src/messaging/l2_to_l1_membership.ts +3 -2
- package/src/note/note_dao.ts +4 -3
- package/src/tests/factories.ts +4 -4
- package/src/tests/mocks.ts +2 -1
- package/src/tx/block_header.ts +2 -2
- package/src/tx/global_variables.ts +8 -8
- package/src/tx/indexed_tx_effect.ts +2 -1
- package/src/tx/private_execution_result.ts +2 -2
- package/src/tx/tx_receipt.ts +3 -2
- package/dest/block/l2_block_number.d.ts +0 -5
- package/dest/block/l2_block_number.d.ts.map +0 -1
- package/dest/block/l2_block_number.js +0 -6
- package/src/block/l2_block_number.ts +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { BlockNumber, BlockNumberSchema, type EpochNumber, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import type { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
@@ -36,27 +36,27 @@ export interface L2BlockSource {
|
|
|
36
36
|
* Gets the number of the latest L2 block processed by the block source implementation.
|
|
37
37
|
* @returns The number of the latest L2 block processed by the block source implementation.
|
|
38
38
|
*/
|
|
39
|
-
getBlockNumber(): Promise<
|
|
39
|
+
getBlockNumber(): Promise<BlockNumber>;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Gets the number of the latest L2 block proven seen by the block source implementation.
|
|
43
43
|
* @returns The number of the latest L2 block proven seen by the block source implementation.
|
|
44
44
|
*/
|
|
45
|
-
getProvenBlockNumber(): Promise<
|
|
45
|
+
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Gets an l2 block. If a negative number is passed, the block returned is the most recent.
|
|
49
49
|
* @param number - The block number to return (inclusive).
|
|
50
50
|
* @returns The requested L2 block.
|
|
51
51
|
*/
|
|
52
|
-
getBlock(number:
|
|
52
|
+
getBlock(number: BlockNumber): Promise<L2Block | undefined>;
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Gets an l2 block header.
|
|
56
56
|
* @param number - The block number to return or 'latest' for the most recent one.
|
|
57
57
|
* @returns The requested L2 block header.
|
|
58
58
|
*/
|
|
59
|
-
getBlockHeader(number:
|
|
59
|
+
getBlockHeader(number: BlockNumber | 'latest'): Promise<BlockHeader | undefined>;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
@@ -65,12 +65,12 @@ export interface L2BlockSource {
|
|
|
65
65
|
* @param proven - If true, only return blocks that have been proven.
|
|
66
66
|
* @returns The requested L2 blocks.
|
|
67
67
|
*/
|
|
68
|
-
getBlocks(from:
|
|
68
|
+
getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2Block[]>;
|
|
69
69
|
|
|
70
70
|
getPublishedCheckpoints(from: number, limit: number): Promise<PublishedCheckpoint[]>;
|
|
71
71
|
|
|
72
72
|
/** Equivalent to getBlocks but includes publish data. */
|
|
73
|
-
getPublishedBlocks(from:
|
|
73
|
+
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<PublishedL2Block[]>;
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Gets a published block by its hash.
|
|
@@ -206,33 +206,26 @@ export type L2BlockTag = 'latest' | 'proven' | 'finalized';
|
|
|
206
206
|
export type L2Tips = Record<L2BlockTag, L2BlockId>;
|
|
207
207
|
|
|
208
208
|
/** Identifies a block by number and hash. */
|
|
209
|
-
export type L2BlockId =
|
|
209
|
+
export type L2BlockId = { number: BlockNumber; hash: string };
|
|
210
210
|
|
|
211
211
|
/** Creates an L2 block id */
|
|
212
|
-
export function makeL2BlockId(number:
|
|
212
|
+
export function makeL2BlockId(number: BlockNumber, hash?: string): L2BlockId {
|
|
213
213
|
if (number !== 0 && !hash) {
|
|
214
214
|
throw new Error(`Hash is required for non-genesis blocks (got block number ${number})`);
|
|
215
215
|
}
|
|
216
216
|
return { number, hash: hash! };
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
z.
|
|
222
|
-
|
|
223
|
-
hash: z.undefined(),
|
|
224
|
-
}),
|
|
225
|
-
z.object({
|
|
226
|
-
number: z.number(),
|
|
227
|
-
hash: z.string(),
|
|
228
|
-
}),
|
|
229
|
-
]);
|
|
219
|
+
const L2BlockIdSchema = z.object({
|
|
220
|
+
number: BlockNumberSchema,
|
|
221
|
+
hash: z.string(),
|
|
222
|
+
});
|
|
230
223
|
|
|
231
224
|
export const L2TipsSchema = z.object({
|
|
232
225
|
latest: L2BlockIdSchema,
|
|
233
226
|
proven: L2BlockIdSchema,
|
|
234
227
|
finalized: L2BlockIdSchema,
|
|
235
|
-
})
|
|
228
|
+
});
|
|
236
229
|
|
|
237
230
|
export enum L2BlockSourceEvents {
|
|
238
231
|
L2PruneDetected = 'l2PruneDetected',
|
|
@@ -242,7 +235,7 @@ export enum L2BlockSourceEvents {
|
|
|
242
235
|
|
|
243
236
|
export type L2BlockProvenEvent = {
|
|
244
237
|
type: 'l2BlockProven';
|
|
245
|
-
blockNumber:
|
|
238
|
+
blockNumber: BlockNumber;
|
|
246
239
|
slotNumber: SlotNumber;
|
|
247
240
|
epochNumber: EpochNumber;
|
|
248
241
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { AbortError } from '@aztec/foundation/error';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
@@ -74,7 +75,7 @@ export class L2BlockStream {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
if (latestBlockNumber < localTips.latest.number) {
|
|
77
|
-
latestBlockNumber = Math.min(latestBlockNumber, sourceTips.latest.number); // see #13471
|
|
78
|
+
latestBlockNumber = BlockNumber(Math.min(latestBlockNumber, sourceTips.latest.number)); // see #13471
|
|
78
79
|
const hash = sourceCache.get(latestBlockNumber) ?? (await this.getBlockHashFromSource(latestBlockNumber));
|
|
79
80
|
if (latestBlockNumber !== 0 && !hash) {
|
|
80
81
|
throw new Error(`Block hash not found in block source for block number ${latestBlockNumber}`);
|
|
@@ -85,7 +86,7 @@ export class L2BlockStream {
|
|
|
85
86
|
|
|
86
87
|
// If we are just starting, use the starting block number from the options.
|
|
87
88
|
if (latestBlockNumber === 0 && this.opts.startingBlock !== undefined) {
|
|
88
|
-
latestBlockNumber = Math.max(this.opts.startingBlock - 1, 0);
|
|
89
|
+
latestBlockNumber = BlockNumber(Math.max(this.opts.startingBlock - 1, 0));
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
// Only log this entry once (for sanity)
|
|
@@ -108,7 +109,11 @@ export class L2BlockStream {
|
|
|
108
109
|
while (nextBlockNumber <= sourceTips.latest.number) {
|
|
109
110
|
const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.latest.number - nextBlockNumber + 1);
|
|
110
111
|
this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit} proven=${this.opts.proven}`);
|
|
111
|
-
const blocks = await this.l2BlockSource.getPublishedBlocks(
|
|
112
|
+
const blocks = await this.l2BlockSource.getPublishedBlocks(
|
|
113
|
+
BlockNumber(nextBlockNumber),
|
|
114
|
+
limit,
|
|
115
|
+
this.opts.proven,
|
|
116
|
+
);
|
|
112
117
|
if (blocks.length === 0) {
|
|
113
118
|
break;
|
|
114
119
|
}
|
|
@@ -139,7 +144,7 @@ export class L2BlockStream {
|
|
|
139
144
|
* @param blockNumber - The block number to test.
|
|
140
145
|
* @param args - A cache of data already requested from source, to avoid re-requesting it.
|
|
141
146
|
*/
|
|
142
|
-
private async areBlockHashesEqualAt(blockNumber:
|
|
147
|
+
private async areBlockHashesEqualAt(blockNumber: BlockNumber, args: { sourceCache: BlockHashCache }) {
|
|
143
148
|
if (blockNumber === 0) {
|
|
144
149
|
return true;
|
|
145
150
|
}
|
|
@@ -163,7 +168,7 @@ export class L2BlockStream {
|
|
|
163
168
|
return localBlockHash === sourceBlockHash;
|
|
164
169
|
}
|
|
165
170
|
|
|
166
|
-
private getBlockHashFromSource(blockNumber:
|
|
171
|
+
private getBlockHashFromSource(blockNumber: BlockNumber) {
|
|
167
172
|
return this.l2BlockSource
|
|
168
173
|
.getBlockHeader(blockNumber)
|
|
169
174
|
.then(h => h?.hash())
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
|
|
1
4
|
import type { L2Block } from '../l2_block.js';
|
|
2
5
|
import type { L2BlockId, L2BlockTag, L2Tips } from '../l2_block_source.js';
|
|
3
6
|
import type { L2BlockStreamEvent, L2BlockStreamEventHandler, L2BlockStreamLocalDataProvider } from './interfaces.js';
|
|
@@ -7,7 +10,7 @@ import type { L2BlockStreamEvent, L2BlockStreamEventHandler, L2BlockStreamLocalD
|
|
|
7
10
|
* @dev tests in kv-store/src/stores/l2_tips_memory_store.test.ts
|
|
8
11
|
*/
|
|
9
12
|
export class L2TipsMemoryStore implements L2BlockStreamEventHandler, L2BlockStreamLocalDataProvider {
|
|
10
|
-
protected readonly l2TipsStore: Map<L2BlockTag,
|
|
13
|
+
protected readonly l2TipsStore: Map<L2BlockTag, BlockNumber> = new Map();
|
|
11
14
|
protected readonly l2BlockHashesStore: Map<number, string> = new Map();
|
|
12
15
|
|
|
13
16
|
public getL2BlockHash(number: number): Promise<string | undefined> {
|
|
@@ -25,7 +28,7 @@ export class L2TipsMemoryStore implements L2BlockStreamEventHandler, L2BlockStre
|
|
|
25
28
|
private getL2Tip(tag: L2BlockTag): L2BlockId {
|
|
26
29
|
const blockNumber = this.l2TipsStore.get(tag);
|
|
27
30
|
if (blockNumber === undefined || blockNumber === 0) {
|
|
28
|
-
return { number:
|
|
31
|
+
return { number: BlockNumber.ZERO, hash: GENESIS_BLOCK_HEADER_HASH.toString() };
|
|
29
32
|
}
|
|
30
33
|
const blockHash = this.l2BlockHashesStore.get(blockNumber);
|
|
31
34
|
if (!blockHash) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
3
|
import { times } from '@aztec/foundation/collection';
|
|
2
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
5
|
import { type L2Block, type L2BlockId, PublishedL2Block } from '@aztec/stdlib/block';
|
|
@@ -15,17 +17,20 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
15
17
|
|
|
16
18
|
const makeBlock = (number: number): PublishedL2Block =>
|
|
17
19
|
PublishedL2Block.fromFields({
|
|
18
|
-
block: { number, hash: () => Promise.resolve(new Fr(number)) } as L2Block,
|
|
20
|
+
block: { number: BlockNumber(number), hash: () => Promise.resolve(new Fr(number)) } as L2Block,
|
|
19
21
|
l1: { blockNumber: BigInt(number), blockHash: `0x${number}`, timestamp: BigInt(number) },
|
|
20
22
|
attestations: [],
|
|
21
23
|
});
|
|
22
24
|
|
|
23
25
|
const makeBlockId = (number: number): L2BlockId => ({
|
|
24
|
-
number,
|
|
26
|
+
number: BlockNumber(number),
|
|
25
27
|
hash: new Fr(number).toString(),
|
|
26
28
|
});
|
|
27
29
|
|
|
28
|
-
const makeTip = (number: number) => ({
|
|
30
|
+
const makeTip = (number: number): L2BlockId => ({
|
|
31
|
+
number: BlockNumber(number),
|
|
32
|
+
hash: number === 0 ? GENESIS_BLOCK_HEADER_HASH.toString() : new Fr(number).toString(),
|
|
33
|
+
});
|
|
29
34
|
|
|
30
35
|
const makeTips = (latest: number, proven: number, finalized: number) => ({
|
|
31
36
|
latest: makeTip(latest),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeCheckpointBlobDataFromBlocks } from '@aztec/blob-lib/encoding';
|
|
2
|
-
import { CheckpointNumber, CheckpointNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { BlockNumber, CheckpointNumber, CheckpointNumberSchema } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
5
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
@@ -80,7 +80,7 @@ export class Checkpoint {
|
|
|
80
80
|
const header = CheckpointHeader.random(options);
|
|
81
81
|
|
|
82
82
|
const blocks = await Promise.all(
|
|
83
|
-
Array.from({ length: numBlocks }, (_, i) => L2BlockNew.random(startBlockNumber + i, options)),
|
|
83
|
+
Array.from({ length: numBlocks }, (_, i) => L2BlockNew.random(BlockNumber(startBlockNumber + i), options)),
|
|
84
84
|
);
|
|
85
85
|
|
|
86
86
|
return new Checkpoint(AppendOnlyTreeSnapshot.random(), header, blocks, checkpointNumber);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
|
|
3
4
|
import type { FunctionSelector } from '../../abi/index.js';
|
|
@@ -11,7 +12,7 @@ export interface ContractDataSource {
|
|
|
11
12
|
* Gets the number of the latest L2 block processed by the implementation.
|
|
12
13
|
* @returns The number of the latest L2 block processed by the implementation.
|
|
13
14
|
*/
|
|
14
|
-
getBlockNumber(): Promise<
|
|
15
|
+
getBlockNumber(): Promise<BlockNumber>;
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Returns the contract class for a given contract class id, or undefined if not found.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { L1ContractAddresses } from '@aztec/ethereum';
|
|
2
|
-
import { CheckpointNumberSchema, EpochNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { BlockNumberSchema, CheckpointNumberSchema, EpochNumberSchema } from '@aztec/foundation/branded-types';
|
|
3
3
|
import type { ApiSchemaFor } from '@aztec/foundation/schemas';
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -75,16 +75,16 @@ export type ArchiverApi = Omit<
|
|
|
75
75
|
export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
76
76
|
getRollupAddress: z.function().args().returns(schemas.EthAddress),
|
|
77
77
|
getRegistryAddress: z.function().args().returns(schemas.EthAddress),
|
|
78
|
-
getBlockNumber: z.function().args().returns(
|
|
79
|
-
getProvenBlockNumber: z.function().args().returns(
|
|
80
|
-
getBlock: z.function().args(
|
|
78
|
+
getBlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
79
|
+
getProvenBlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
80
|
+
getBlock: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
|
|
81
81
|
getBlockHeader: z
|
|
82
82
|
.function()
|
|
83
|
-
.args(z.union([
|
|
83
|
+
.args(z.union([BlockNumberSchema, z.literal('latest')]))
|
|
84
84
|
.returns(BlockHeader.schema.optional()),
|
|
85
85
|
getBlocks: z
|
|
86
86
|
.function()
|
|
87
|
-
.args(
|
|
87
|
+
.args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
|
|
88
88
|
.returns(z.array(L2Block.schema)),
|
|
89
89
|
getPublishedCheckpoints: z
|
|
90
90
|
.function()
|
|
@@ -92,7 +92,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
92
92
|
.returns(z.array(PublishedCheckpoint.schema)),
|
|
93
93
|
getPublishedBlocks: z
|
|
94
94
|
.function()
|
|
95
|
-
.args(
|
|
95
|
+
.args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
|
|
96
96
|
.returns(z.array(PublishedL2Block.schema)),
|
|
97
97
|
getPublishedBlockByHash: z.function().args(schemas.Fr).returns(PublishedL2Block.schema.optional()),
|
|
98
98
|
getPublishedBlockByArchive: z.function().args(schemas.Fr).returns(PublishedL2Block.schema.optional()),
|
|
@@ -107,7 +107,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
107
107
|
getBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
|
|
108
108
|
isEpochComplete: z.function().args(EpochNumberSchema).returns(z.boolean()),
|
|
109
109
|
getL2Tips: z.function().args().returns(L2TipsSchema),
|
|
110
|
-
getPrivateLogs: z.function().args(
|
|
110
|
+
getPrivateLogs: z.function().args(BlockNumberSchema, z.number()).returns(z.array(PrivateLog.schema)),
|
|
111
111
|
getLogsByTags: z
|
|
112
112
|
.function()
|
|
113
113
|
.args(z.array(schemas.Fr))
|
|
@@ -123,7 +123,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
123
123
|
getContractClassIds: z.function().args().returns(z.array(schemas.Fr)),
|
|
124
124
|
registerContractFunctionSignatures: z.function().args(z.array(z.string())).returns(z.void()),
|
|
125
125
|
getL1ToL2MessagesForCheckpoint: z.function().args(CheckpointNumberSchema).returns(z.array(schemas.Fr)),
|
|
126
|
-
getL1ToL2Messages: z.function().args(
|
|
126
|
+
getL1ToL2Messages: z.function().args(BlockNumberSchema).returns(z.array(schemas.Fr)),
|
|
127
127
|
getL1ToL2MessageIndex: z.function().args(schemas.Fr).returns(schemas.BigInt.optional()),
|
|
128
128
|
getDebugFunctionName: z.function().args(schemas.AztecAddress, schemas.FunctionSelector).returns(optional(z.string())),
|
|
129
129
|
getL1Constants: z.function().args().returns(L1RollupConstantsSchema),
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARCHIVE_HEIGHT,
|
|
3
|
-
INITIAL_L2_BLOCK_NUM,
|
|
4
3
|
L1_TO_L2_MSG_TREE_HEIGHT,
|
|
5
4
|
NOTE_HASH_TREE_HEIGHT,
|
|
6
5
|
NULLIFIER_TREE_HEIGHT,
|
|
7
6
|
PUBLIC_DATA_TREE_HEIGHT,
|
|
8
7
|
} from '@aztec/constants';
|
|
9
8
|
import { type L1ContractAddresses, L1ContractAddressesSchema } from '@aztec/ethereum/l1-contract-addresses';
|
|
10
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
BlockNumber,
|
|
11
|
+
BlockNumberPositiveSchema,
|
|
12
|
+
BlockNumberSchema,
|
|
13
|
+
type SlotNumber,
|
|
14
|
+
} from '@aztec/foundation/branded-types';
|
|
11
15
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
16
|
import type { Fr } from '@aztec/foundation/fields';
|
|
13
17
|
import { createSafeJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client';
|
|
@@ -16,9 +20,9 @@ import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
|
|
|
16
20
|
import { z } from 'zod';
|
|
17
21
|
|
|
18
22
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
23
|
+
import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
|
|
19
24
|
import { type DataInBlock, inBlockSchemaFor } from '../block/in_block.js';
|
|
20
25
|
import { L2Block } from '../block/l2_block.js';
|
|
21
|
-
import { type L2BlockNumber, L2BlockNumberSchema } from '../block/l2_block_number.js';
|
|
22
26
|
import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
23
27
|
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
24
28
|
import {
|
|
@@ -88,7 +92,7 @@ export interface AztecNode
|
|
|
88
92
|
* @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
|
|
89
93
|
*/
|
|
90
94
|
findLeavesIndexes(
|
|
91
|
-
blockNumber:
|
|
95
|
+
blockNumber: BlockParameter,
|
|
92
96
|
treeId: MerkleTreeId,
|
|
93
97
|
leafValues: Fr[],
|
|
94
98
|
): Promise<(DataInBlock<bigint> | undefined)[]>;
|
|
@@ -100,7 +104,7 @@ export interface AztecNode
|
|
|
100
104
|
* @returns The sibling path for the leaf index.
|
|
101
105
|
*/
|
|
102
106
|
getNullifierSiblingPath(
|
|
103
|
-
blockNumber:
|
|
107
|
+
blockNumber: BlockParameter,
|
|
104
108
|
leafIndex: bigint,
|
|
105
109
|
): Promise<SiblingPath<typeof NULLIFIER_TREE_HEIGHT>>;
|
|
106
110
|
|
|
@@ -111,7 +115,7 @@ export interface AztecNode
|
|
|
111
115
|
* @returns The sibling path for the leaf index.
|
|
112
116
|
*/
|
|
113
117
|
getNoteHashSiblingPath(
|
|
114
|
-
blockNumber:
|
|
118
|
+
blockNumber: BlockParameter,
|
|
115
119
|
leafIndex: bigint,
|
|
116
120
|
): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>>;
|
|
117
121
|
|
|
@@ -121,7 +125,7 @@ export interface AztecNode
|
|
|
121
125
|
* @param leafIndex - Index of the leaf in the tree.
|
|
122
126
|
* @returns The sibling path.
|
|
123
127
|
*/
|
|
124
|
-
getArchiveSiblingPath(blockNumber:
|
|
128
|
+
getArchiveSiblingPath(blockNumber: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof ARCHIVE_HEIGHT>>;
|
|
125
129
|
|
|
126
130
|
/**
|
|
127
131
|
* Returns a sibling path for a leaf in the committed public data tree.
|
|
@@ -130,7 +134,7 @@ export interface AztecNode
|
|
|
130
134
|
* @returns The sibling path.
|
|
131
135
|
*/
|
|
132
136
|
getPublicDataSiblingPath(
|
|
133
|
-
blockNumber:
|
|
137
|
+
blockNumber: BlockParameter,
|
|
134
138
|
leafIndex: bigint,
|
|
135
139
|
): Promise<SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>>;
|
|
136
140
|
|
|
@@ -141,7 +145,7 @@ export interface AztecNode
|
|
|
141
145
|
* @returns The nullifier membership witness (if found).
|
|
142
146
|
*/
|
|
143
147
|
getNullifierMembershipWitness(
|
|
144
|
-
blockNumber:
|
|
148
|
+
blockNumber: BlockParameter,
|
|
145
149
|
nullifier: Fr,
|
|
146
150
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
147
151
|
|
|
@@ -155,7 +159,7 @@ export interface AztecNode
|
|
|
155
159
|
* we are trying to prove non-inclusion for.
|
|
156
160
|
*/
|
|
157
161
|
getLowNullifierMembershipWitness(
|
|
158
|
-
blockNumber:
|
|
162
|
+
blockNumber: BlockParameter,
|
|
159
163
|
nullifier: Fr,
|
|
160
164
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
161
165
|
|
|
@@ -168,7 +172,7 @@ export interface AztecNode
|
|
|
168
172
|
* "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
|
|
169
173
|
* is contained in the leaf preimage.
|
|
170
174
|
*/
|
|
171
|
-
getPublicDataWitness(blockNumber:
|
|
175
|
+
getPublicDataWitness(blockNumber: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
172
176
|
|
|
173
177
|
/**
|
|
174
178
|
* Returns a membership witness for a given archive leaf at a given block.
|
|
@@ -176,7 +180,7 @@ export interface AztecNode
|
|
|
176
180
|
* @param archive - The archive leaf we try to find the witness for.
|
|
177
181
|
*/
|
|
178
182
|
getArchiveMembershipWitness(
|
|
179
|
-
blockNumber:
|
|
183
|
+
blockNumber: BlockParameter,
|
|
180
184
|
archive: Fr,
|
|
181
185
|
): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined>;
|
|
182
186
|
|
|
@@ -186,7 +190,7 @@ export interface AztecNode
|
|
|
186
190
|
* @param noteHash - The note hash we try to find the witness for.
|
|
187
191
|
*/
|
|
188
192
|
getNoteHashMembershipWitness(
|
|
189
|
-
blockNumber:
|
|
193
|
+
blockNumber: BlockParameter,
|
|
190
194
|
noteHash: Fr,
|
|
191
195
|
): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
|
|
192
196
|
|
|
@@ -197,12 +201,12 @@ export interface AztecNode
|
|
|
197
201
|
* @returns A tuple of the index and the sibling path of the L1ToL2Message (undefined if not found).
|
|
198
202
|
*/
|
|
199
203
|
getL1ToL2MessageMembershipWitness(
|
|
200
|
-
blockNumber:
|
|
204
|
+
blockNumber: BlockParameter,
|
|
201
205
|
l1ToL2Message: Fr,
|
|
202
206
|
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined>;
|
|
203
207
|
|
|
204
208
|
/** Returns the L2 block number in which this L1 to L2 message becomes available, or undefined if not found. */
|
|
205
|
-
getL1ToL2MessageBlock(l1ToL2Message: Fr): Promise<
|
|
209
|
+
getL1ToL2MessageBlock(l1ToL2Message: Fr): Promise<BlockNumber | undefined>;
|
|
206
210
|
|
|
207
211
|
/**
|
|
208
212
|
* Returns whether an L1 to L2 message is synced by archiver.
|
|
@@ -217,14 +221,14 @@ export interface AztecNode
|
|
|
217
221
|
* @param blockNumber - The block number at which to get the data.
|
|
218
222
|
* @returns The L2 to L1 messages (undefined if the block number is not found).
|
|
219
223
|
*/
|
|
220
|
-
getL2ToL1Messages(blockNumber:
|
|
224
|
+
getL2ToL1Messages(blockNumber: BlockParameter): Promise<Fr[][] | undefined>;
|
|
221
225
|
|
|
222
226
|
/**
|
|
223
227
|
* Get a block specified by its number.
|
|
224
228
|
* @param number - The block number being requested.
|
|
225
229
|
* @returns The requested block.
|
|
226
230
|
*/
|
|
227
|
-
getBlock(number:
|
|
231
|
+
getBlock(number: BlockParameter): Promise<L2Block | undefined>;
|
|
228
232
|
|
|
229
233
|
/**
|
|
230
234
|
* Get a block specified by its hash.
|
|
@@ -244,13 +248,13 @@ export interface AztecNode
|
|
|
244
248
|
* Method to fetch the latest block number synchronized by the node.
|
|
245
249
|
* @returns The block number.
|
|
246
250
|
*/
|
|
247
|
-
getBlockNumber(): Promise<
|
|
251
|
+
getBlockNumber(): Promise<BlockNumber>;
|
|
248
252
|
|
|
249
253
|
/**
|
|
250
254
|
* Fetches the latest proven block number.
|
|
251
255
|
* @returns The block number.
|
|
252
256
|
*/
|
|
253
|
-
getProvenBlockNumber(): Promise<
|
|
257
|
+
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
254
258
|
|
|
255
259
|
/**
|
|
256
260
|
* Method to determine if the node is ready to accept transactions.
|
|
@@ -271,7 +275,7 @@ export interface AztecNode
|
|
|
271
275
|
* @param limit - The maximum number of blocks to return.
|
|
272
276
|
* @returns The blocks requested.
|
|
273
277
|
*/
|
|
274
|
-
getBlocks(from:
|
|
278
|
+
getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
|
|
275
279
|
|
|
276
280
|
/**
|
|
277
281
|
* Method to fetch the current base fees.
|
|
@@ -326,7 +330,7 @@ export interface AztecNode
|
|
|
326
330
|
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
327
331
|
* @returns An array of private logs from the specified range of blocks.
|
|
328
332
|
*/
|
|
329
|
-
getPrivateLogs(from:
|
|
333
|
+
getPrivateLogs(from: BlockNumber, limit: number): Promise<PrivateLog[]>;
|
|
330
334
|
|
|
331
335
|
/**
|
|
332
336
|
* Gets public logs based on the provided filter.
|
|
@@ -413,13 +417,13 @@ export interface AztecNode
|
|
|
413
417
|
* @param blockNumber - The block number at which to get the data or 'latest'.
|
|
414
418
|
* @returns Storage value at the given contract slot.
|
|
415
419
|
*/
|
|
416
|
-
getPublicStorageAt(blockNumber:
|
|
420
|
+
getPublicStorageAt(blockNumber: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
417
421
|
|
|
418
422
|
/**
|
|
419
423
|
* Returns the currently committed block header.
|
|
420
424
|
* @returns The current committed block header.
|
|
421
425
|
*/
|
|
422
|
-
getBlockHeader(blockNumber?:
|
|
426
|
+
getBlockHeader(blockNumber?: BlockParameter): Promise<BlockHeader | undefined>;
|
|
423
427
|
|
|
424
428
|
/**
|
|
425
429
|
* Get a block header specified by its hash.
|
|
@@ -497,74 +501,77 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
497
501
|
|
|
498
502
|
findLeavesIndexes: z
|
|
499
503
|
.function()
|
|
500
|
-
.args(
|
|
504
|
+
.args(BlockParameterSchema, z.nativeEnum(MerkleTreeId), z.array(schemas.Fr).max(MAX_RPC_LEN))
|
|
501
505
|
.returns(z.array(optional(inBlockSchemaFor(schemas.BigInt)))),
|
|
502
506
|
|
|
503
507
|
getNullifierSiblingPath: z
|
|
504
508
|
.function()
|
|
505
|
-
.args(
|
|
509
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
506
510
|
.returns(SiblingPath.schemaFor(NULLIFIER_TREE_HEIGHT)),
|
|
507
511
|
|
|
508
512
|
getNoteHashSiblingPath: z
|
|
509
513
|
.function()
|
|
510
|
-
.args(
|
|
514
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
511
515
|
.returns(SiblingPath.schemaFor(NOTE_HASH_TREE_HEIGHT)),
|
|
512
516
|
|
|
513
517
|
getArchiveSiblingPath: z
|
|
514
518
|
.function()
|
|
515
|
-
.args(
|
|
519
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
516
520
|
.returns(SiblingPath.schemaFor(ARCHIVE_HEIGHT)),
|
|
517
521
|
|
|
518
522
|
getPublicDataSiblingPath: z
|
|
519
523
|
.function()
|
|
520
|
-
.args(
|
|
524
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
521
525
|
.returns(SiblingPath.schemaFor(PUBLIC_DATA_TREE_HEIGHT)),
|
|
522
526
|
|
|
523
527
|
getNullifierMembershipWitness: z
|
|
524
528
|
.function()
|
|
525
|
-
.args(
|
|
529
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
526
530
|
.returns(NullifierMembershipWitness.schema.optional()),
|
|
527
531
|
|
|
528
532
|
getLowNullifierMembershipWitness: z
|
|
529
533
|
.function()
|
|
530
|
-
.args(
|
|
534
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
531
535
|
.returns(NullifierMembershipWitness.schema.optional()),
|
|
532
536
|
|
|
533
|
-
getPublicDataWitness: z
|
|
537
|
+
getPublicDataWitness: z
|
|
538
|
+
.function()
|
|
539
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
540
|
+
.returns(PublicDataWitness.schema.optional()),
|
|
534
541
|
|
|
535
542
|
getArchiveMembershipWitness: z
|
|
536
543
|
.function()
|
|
537
|
-
.args(
|
|
544
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
538
545
|
.returns(MembershipWitness.schemaFor(ARCHIVE_HEIGHT).optional()),
|
|
539
546
|
|
|
540
547
|
getNoteHashMembershipWitness: z
|
|
541
548
|
.function()
|
|
542
|
-
.args(
|
|
549
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
543
550
|
.returns(MembershipWitness.schemaFor(NOTE_HASH_TREE_HEIGHT).optional()),
|
|
544
551
|
|
|
545
552
|
getL1ToL2MessageMembershipWitness: z
|
|
546
553
|
.function()
|
|
547
|
-
.args(
|
|
554
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
548
555
|
.returns(z.tuple([schemas.BigInt, SiblingPath.schemaFor(L1_TO_L2_MSG_TREE_HEIGHT)]).optional()),
|
|
549
556
|
|
|
550
|
-
getL1ToL2MessageBlock: z.function().args(schemas.Fr).returns(
|
|
557
|
+
getL1ToL2MessageBlock: z.function().args(schemas.Fr).returns(BlockNumberSchema.optional()),
|
|
551
558
|
|
|
552
559
|
isL1ToL2MessageSynced: z.function().args(schemas.Fr).returns(z.boolean()),
|
|
553
560
|
|
|
554
561
|
getL2ToL1Messages: z
|
|
555
562
|
.function()
|
|
556
|
-
.args(
|
|
563
|
+
.args(BlockParameterSchema)
|
|
557
564
|
.returns(z.array(z.array(schemas.Fr)).optional()),
|
|
558
565
|
|
|
559
|
-
getBlock: z.function().args(
|
|
566
|
+
getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
|
|
560
567
|
|
|
561
568
|
getBlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
562
569
|
|
|
563
570
|
getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
564
571
|
|
|
565
|
-
getBlockNumber: z.function().returns(
|
|
572
|
+
getBlockNumber: z.function().returns(BlockNumberSchema),
|
|
566
573
|
|
|
567
|
-
getProvenBlockNumber: z.function().returns(
|
|
574
|
+
getProvenBlockNumber: z.function().returns(BlockNumberSchema),
|
|
568
575
|
|
|
569
576
|
isReady: z.function().returns(z.boolean()),
|
|
570
577
|
|
|
@@ -572,12 +579,12 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
572
579
|
|
|
573
580
|
getBlocks: z
|
|
574
581
|
.function()
|
|
575
|
-
.args(
|
|
582
|
+
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
576
583
|
.returns(z.array(L2Block.schema)),
|
|
577
584
|
|
|
578
585
|
getPublishedBlocks: z
|
|
579
586
|
.function()
|
|
580
|
-
.args(
|
|
587
|
+
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
581
588
|
.returns(z.array(PublishedL2Block.schema)),
|
|
582
589
|
|
|
583
590
|
getCurrentBaseFees: z.function().returns(GasFees.schema),
|
|
@@ -601,7 +608,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
601
608
|
|
|
602
609
|
getPrivateLogs: z
|
|
603
610
|
.function()
|
|
604
|
-
.args(
|
|
611
|
+
.args(BlockNumberPositiveSchema, z.number().lte(MAX_RPC_LEN))
|
|
605
612
|
.returns(z.array(PrivateLog.schema)),
|
|
606
613
|
|
|
607
614
|
getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
|
|
@@ -633,9 +640,9 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
633
640
|
|
|
634
641
|
getTxsByHash: z.function().args(z.array(TxHash.schema).max(MAX_RPC_TXS_LEN)).returns(z.array(Tx.schema)),
|
|
635
642
|
|
|
636
|
-
getPublicStorageAt: z.function().args(
|
|
643
|
+
getPublicStorageAt: z.function().args(BlockParameterSchema, schemas.AztecAddress, schemas.Fr).returns(schemas.Fr),
|
|
637
644
|
|
|
638
|
-
getBlockHeader: z.function().args(optional(
|
|
645
|
+
getBlockHeader: z.function().args(optional(BlockParameterSchema)).returns(BlockHeader.schema.optional()),
|
|
639
646
|
|
|
640
647
|
getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
|
|
641
648
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import type { Timer } from '@aztec/foundation/timer';
|
|
3
4
|
|
|
@@ -74,5 +75,5 @@ export interface IFullNodeBlockBuilder {
|
|
|
74
75
|
fork?: MerkleTreeWriteOperations,
|
|
75
76
|
): Promise<BuildBlockResult>;
|
|
76
77
|
|
|
77
|
-
getFork(blockNumber:
|
|
78
|
+
getFork(blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations>;
|
|
78
79
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib/types';
|
|
2
|
-
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import type { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
|
|
@@ -47,7 +47,7 @@ export interface EpochProver extends Omit<IBlockFactory, 'setBlockCompleted' | '
|
|
|
47
47
|
* @param timestamp - The timestamp of the block.
|
|
48
48
|
* @param totalNumTxs - The total number of txs in the block.
|
|
49
49
|
*/
|
|
50
|
-
startNewBlock(blockNumber:
|
|
50
|
+
startNewBlock(blockNumber: BlockNumber, timestamp: UInt64, totalNumTxs: number): Promise<void>;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Kickstarts chonk verifier circuits for the specified txs. These will be used during epoch proving.
|
|
@@ -56,7 +56,7 @@ export interface EpochProver extends Omit<IBlockFactory, 'setBlockCompleted' | '
|
|
|
56
56
|
startChonkVerifierCircuits(txs: Tx[]): Promise<void>;
|
|
57
57
|
|
|
58
58
|
/** Returns the block. */
|
|
59
|
-
setBlockCompleted(blockNumber:
|
|
59
|
+
setBlockCompleted(blockNumber: BlockNumber, expectedBlockHeader?: BlockHeader): Promise<BlockHeader>;
|
|
60
60
|
|
|
61
61
|
/** Pads the epoch with empty block roots if needed and blocks until proven. Throws if proving has failed. */
|
|
62
62
|
finalizeEpoch(): Promise<{ publicInputs: RootRollupPublicInputs; proof: Proof; batchedBlobInputs: BatchedBlob }>;
|