@aztec/stdlib 3.0.0-nightly.20250916 → 3.0.0-nightly.20250918
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 +78 -1
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +20 -2
- package/dest/avm/avm_circuit_public_inputs.d.ts +6 -1
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +11 -6
- package/dest/avm/avm_proving_request.d.ts +41 -0
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/body.d.ts +4 -1
- package/dest/block/body.d.ts.map +1 -1
- package/dest/block/body.js +16 -5
- package/dest/block/index.d.ts +1 -0
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -0
- package/dest/block/l2_block.d.ts +8 -5
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +14 -7
- package/dest/block/l2_block_code_to_purge.d.ts +3 -14
- package/dest/block/l2_block_code_to_purge.d.ts.map +1 -1
- package/dest/block/l2_block_code_to_purge.js +23 -13
- package/dest/block/l2_block_header.d.ts +100 -0
- package/dest/block/l2_block_header.d.ts.map +1 -0
- package/dest/block/l2_block_header.js +146 -0
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +1 -1
- package/dest/block/published_l2_block.d.ts +2 -2
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +1 -3
- package/dest/interfaces/aztec-node.d.ts +5 -2
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +1 -0
- package/dest/interfaces/block-builder.d.ts +1 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/epoch-prover.d.ts +25 -8
- package/dest/interfaces/epoch-prover.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +204 -61
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +101 -39
- package/dest/interfaces/pxe.d.ts +8 -1
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/pxe.js +1 -0
- package/dest/interfaces/server_circuit_prover.d.ts +19 -16
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +3 -2
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +4 -4
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +7 -7
- package/dest/kernel/private_context_inputs.d.ts +2 -2
- package/dest/kernel/private_context_inputs.d.ts.map +1 -1
- package/dest/kernel/private_context_inputs.js +4 -4
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +1 -1
- package/dest/messaging/inbox_leaf.d.ts +2 -0
- package/dest/messaging/inbox_leaf.d.ts.map +1 -1
- package/dest/messaging/inbox_leaf.js +3 -0
- package/dest/p2p/consensus_payload.d.ts +7 -6
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +7 -6
- package/dest/parity/root_parity_input.d.ts +1 -1
- package/dest/proofs/proof_data.d.ts +1 -1
- package/dest/proofs/proof_data.d.ts.map +1 -1
- package/dest/proofs/proof_data.js +2 -2
- package/dest/proofs/proving_request_type.d.ts +13 -8
- package/dest/proofs/proving_request_type.d.ts.map +1 -1
- package/dest/proofs/proving_request_type.js +13 -8
- package/dest/rollup/base_or_merge_rollup_public_inputs.d.ts +1 -1
- package/dest/rollup/base_or_merge_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/base_or_merge_rollup_public_inputs.js +1 -1
- package/dest/rollup/base_rollup_hints.d.ts +12 -3
- package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
- package/dest/rollup/base_rollup_hints.js +11 -5
- package/dest/rollup/block_constant_data.d.ts +20 -6
- package/dest/rollup/block_constant_data.d.ts.map +1 -1
- package/dest/rollup/block_constant_data.js +15 -7
- package/dest/rollup/block_merge_rollup.d.ts +10 -9
- package/dest/rollup/block_merge_rollup.d.ts.map +1 -1
- package/dest/rollup/block_merge_rollup.js +14 -13
- package/dest/rollup/block_rollup_public_inputs.d.ts +124 -0
- package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -0
- package/dest/rollup/block_rollup_public_inputs.js +85 -0
- package/dest/rollup/block_root_rollup.d.ts +148 -184
- package/dest/rollup/block_root_rollup.d.ts.map +1 -1
- package/dest/rollup/block_root_rollup.js +211 -260
- package/dest/rollup/checkpoint_constant_data.d.ts +54 -0
- package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -0
- package/dest/rollup/checkpoint_constant_data.js +55 -0
- package/dest/{tx/proposed_block_header.d.ts → rollup/checkpoint_header.d.ts} +11 -12
- package/dest/rollup/checkpoint_header.d.ts.map +1 -0
- package/dest/{tx/proposed_block_header.js → rollup/checkpoint_header.js} +9 -9
- package/dest/rollup/checkpoint_merge_rollup.d.ts +30 -0
- package/dest/rollup/checkpoint_merge_rollup.d.ts.map +1 -0
- package/dest/rollup/checkpoint_merge_rollup.js +37 -0
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +105 -0
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -0
- package/dest/rollup/checkpoint_rollup_public_inputs.js +105 -0
- package/dest/rollup/checkpoint_root_rollup.d.ts +117 -0
- package/dest/rollup/checkpoint_root_rollup.d.ts.map +1 -0
- package/dest/rollup/checkpoint_root_rollup.js +178 -0
- package/dest/rollup/epoch_constant_data.d.ts +19 -2
- package/dest/rollup/epoch_constant_data.d.ts.map +1 -1
- package/dest/rollup/epoch_constant_data.js +20 -7
- package/dest/rollup/index.d.ts +8 -5
- package/dest/rollup/index.d.ts.map +1 -1
- package/dest/rollup/index.js +8 -5
- package/dest/rollup/rollup_proof_data.d.ts +10 -0
- package/dest/rollup/rollup_proof_data.d.ts.map +1 -0
- package/dest/rollup/rollup_proof_data.js +1 -0
- package/dest/rollup/root_rollup.d.ts +26 -23
- package/dest/rollup/root_rollup.d.ts.map +1 -1
- package/dest/rollup/root_rollup.js +28 -39
- package/dest/stats/stats.d.ts +1 -1
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +17 -41
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +76 -80
- package/dest/tests/mocks.d.ts +3 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +3 -3
- package/dest/tx/block_header.d.ts +12 -13
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +16 -21
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +0 -1
- package/dest/tx/index.d.ts +0 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/private_execution_result.d.ts +2 -2
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +3 -3
- package/dest/tx/tx_constant_data.d.ts +4 -4
- package/dest/tx/tx_constant_data.d.ts.map +1 -1
- package/dest/tx/tx_constant_data.js +6 -6
- package/dest/tx/tx_effect.d.ts +0 -3
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +2 -7
- package/dest/zkpassport/index.d.ts +3 -3
- package/dest/zkpassport/index.d.ts.map +1 -1
- package/dest/zkpassport/index.js +7 -7
- package/package.json +8 -8
- package/src/avm/avm.ts +22 -0
- package/src/avm/avm_circuit_public_inputs.ts +10 -0
- package/src/block/body.ts +23 -6
- package/src/block/index.ts +1 -0
- package/src/block/l2_block.ts +18 -8
- package/src/block/l2_block_code_to_purge.ts +30 -31
- package/src/block/l2_block_header.ts +232 -0
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +1 -1
- package/src/block/test/l2_tips_store_test_suite.ts +1 -2
- package/src/interfaces/aztec-node.ts +8 -2
- package/src/interfaces/block-builder.ts +1 -6
- package/src/interfaces/epoch-prover.ts +34 -10
- package/src/interfaces/proving-job.ts +166 -51
- package/src/interfaces/pxe.ts +10 -1
- package/src/interfaces/server_circuit_prover.ts +65 -29
- package/src/interfaces/validator.ts +3 -2
- package/src/kernel/private_circuit_public_inputs.ts +5 -5
- package/src/kernel/private_context_inputs.ts +2 -2
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +1 -1
- package/src/messaging/inbox_leaf.ts +5 -0
- package/src/p2p/consensus_payload.ts +8 -7
- package/src/proofs/proof_data.ts +1 -6
- package/src/proofs/proving_request_type.ts +8 -3
- package/src/rollup/base_or_merge_rollup_public_inputs.ts +1 -1
- package/src/rollup/base_rollup_hints.ts +9 -1
- package/src/rollup/block_constant_data.ts +13 -3
- package/src/rollup/block_merge_rollup.ts +13 -11
- package/src/rollup/block_rollup_public_inputs.ts +123 -0
- package/src/rollup/block_root_rollup.ts +209 -264
- package/src/rollup/checkpoint_constant_data.ts +84 -0
- package/src/{tx/proposed_block_header.ts → rollup/checkpoint_header.ts} +16 -17
- package/src/rollup/checkpoint_merge_rollup.ts +50 -0
- package/src/rollup/{block_root_or_block_merge_public_inputs.ts → checkpoint_rollup_public_inputs.ts} +26 -52
- package/src/rollup/checkpoint_root_rollup.ts +216 -0
- package/src/rollup/epoch_constant_data.ts +32 -8
- package/src/rollup/index.ts +8 -5
- package/src/rollup/rollup_proof_data.ts +12 -0
- package/src/rollup/root_rollup.ts +30 -41
- package/src/stats/stats.ts +8 -3
- package/src/tests/factories.ts +139 -135
- package/src/tests/mocks.ts +6 -13
- package/src/tx/block_header.ts +17 -32
- package/src/tx/global_variables.ts +0 -1
- package/src/tx/index.ts +0 -1
- package/src/tx/private_execution_result.ts +3 -3
- package/src/tx/tx_constant_data.ts +4 -4
- package/src/tx/tx_effect.ts +2 -7
- package/src/zkpassport/index.ts +6 -6
- package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts +0 -134
- package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts.map +0 -1
- package/dest/rollup/block_root_or_block_merge_public_inputs.js +0 -125
- package/dest/rollup/empty_block_root_rollup_inputs.d.ts +0 -51
- package/dest/rollup/empty_block_root_rollup_inputs.d.ts.map +0 -1
- package/dest/rollup/empty_block_root_rollup_inputs.js +0 -65
- package/dest/rollup/padding_block_root_rollup_inputs.d.ts +0 -20
- package/dest/rollup/padding_block_root_rollup_inputs.d.ts.map +0 -1
- package/dest/rollup/padding_block_root_rollup_inputs.js +0 -39
- package/dest/rollup/previous_rollup_block_data.d.ts +0 -47
- package/dest/rollup/previous_rollup_block_data.d.ts.map +0 -1
- package/dest/rollup/previous_rollup_block_data.js +0 -37
- package/dest/tx/proposed_block_header.d.ts.map +0 -1
- package/src/rollup/empty_block_root_rollup_inputs.ts +0 -80
- package/src/rollup/padding_block_root_rollup_inputs.ts +0 -47
- package/src/rollup/previous_rollup_block_data.ts +0 -48
|
@@ -35,4 +35,9 @@ export class InboxLeaf {
|
|
|
35
35
|
const end = start + BigInt(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
36
36
|
return [start, end];
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
/** Returns the L2 block number for a given leaf index */
|
|
40
|
+
static l2BlockFromIndex(index: bigint): number {
|
|
41
|
+
return Number(index / BigInt(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP)) + INITIAL_L2_BLOCK_NUM;
|
|
42
|
+
}
|
|
38
43
|
}
|
|
@@ -8,7 +8,8 @@ import { encodeAbiParameters, parseAbiParameters } from 'viem';
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
|
|
10
10
|
import type { L2Block } from '../block/l2_block.js';
|
|
11
|
-
import {
|
|
11
|
+
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
12
|
+
import { StateReference } from '../tx/state_reference.js';
|
|
12
13
|
import type { Signable, SignatureDomainSeparator } from './signature_utils.js';
|
|
13
14
|
|
|
14
15
|
export class ConsensusPayload implements Signable {
|
|
@@ -16,7 +17,7 @@ export class ConsensusPayload implements Signable {
|
|
|
16
17
|
|
|
17
18
|
constructor(
|
|
18
19
|
/** The proposed block header the attestation is made over */
|
|
19
|
-
public readonly header:
|
|
20
|
+
public readonly header: CheckpointHeader,
|
|
20
21
|
/** The archive root after the block is added */
|
|
21
22
|
public readonly archive: Fr,
|
|
22
23
|
/** The state reference after the block is added */
|
|
@@ -26,7 +27,7 @@ export class ConsensusPayload implements Signable {
|
|
|
26
27
|
static get schema() {
|
|
27
28
|
return z
|
|
28
29
|
.object({
|
|
29
|
-
header:
|
|
30
|
+
header: CheckpointHeader.schema,
|
|
30
31
|
archive: schemas.Fr,
|
|
31
32
|
stateReference: StateReference.schema,
|
|
32
33
|
})
|
|
@@ -66,7 +67,7 @@ export class ConsensusPayload implements Signable {
|
|
|
66
67
|
static fromBuffer(buf: Buffer | BufferReader): ConsensusPayload {
|
|
67
68
|
const reader = BufferReader.asReader(buf);
|
|
68
69
|
const payload = new ConsensusPayload(
|
|
69
|
-
reader.readObject(
|
|
70
|
+
reader.readObject(CheckpointHeader),
|
|
70
71
|
reader.readObject(Fr),
|
|
71
72
|
reader.readObject(StateReference),
|
|
72
73
|
);
|
|
@@ -78,15 +79,15 @@ export class ConsensusPayload implements Signable {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
static fromBlock(block: L2Block): ConsensusPayload {
|
|
81
|
-
return new ConsensusPayload(block.header.
|
|
82
|
+
return new ConsensusPayload(block.header.toCheckpointHeader(), block.archive.root, block.header.state);
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
static empty(): ConsensusPayload {
|
|
85
|
-
return new ConsensusPayload(
|
|
86
|
+
return new ConsensusPayload(CheckpointHeader.empty(), Fr.ZERO, StateReference.empty());
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
static random(): ConsensusPayload {
|
|
89
|
-
return new ConsensusPayload(
|
|
90
|
+
return new ConsensusPayload(CheckpointHeader.random(), Fr.random(), StateReference.random());
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
/**
|
package/src/proofs/proof_data.ts
CHANGED
|
@@ -23,14 +23,9 @@ export class ProofData<T extends Bufferable, PROOF_LENGTH extends number> {
|
|
|
23
23
|
publicInputs: {
|
|
24
24
|
fromBuffer: (reader: BufferReader) => T;
|
|
25
25
|
},
|
|
26
|
-
proofLength?: PROOF_LENGTH,
|
|
27
26
|
): ProofData<T, PROOF_LENGTH> {
|
|
28
27
|
const reader = BufferReader.asReader(buffer);
|
|
29
|
-
return new ProofData(
|
|
30
|
-
reader.readObject(publicInputs),
|
|
31
|
-
RecursiveProof.fromBuffer(reader, proofLength),
|
|
32
|
-
reader.readObject(VkData),
|
|
33
|
-
);
|
|
28
|
+
return new ProofData(reader.readObject(publicInputs), RecursiveProof.fromBuffer(reader), reader.readObject(VkData));
|
|
34
29
|
}
|
|
35
30
|
}
|
|
36
31
|
|
|
@@ -4,11 +4,16 @@ export enum ProvingRequestType {
|
|
|
4
4
|
PRIVATE_BASE_ROLLUP,
|
|
5
5
|
PUBLIC_BASE_ROLLUP,
|
|
6
6
|
MERGE_ROLLUP,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
BLOCK_ROOT_FIRST_ROLLUP,
|
|
8
|
+
BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP,
|
|
9
|
+
BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP,
|
|
9
10
|
BLOCK_ROOT_ROLLUP,
|
|
10
|
-
|
|
11
|
+
BLOCK_ROOT_SINGLE_TX_ROLLUP,
|
|
11
12
|
BLOCK_MERGE_ROLLUP,
|
|
13
|
+
CHECKPOINT_ROOT_ROLLUP,
|
|
14
|
+
CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP,
|
|
15
|
+
CHECKPOINT_PADDING_ROLLUP,
|
|
16
|
+
CHECKPOINT_MERGE_ROLLUP,
|
|
12
17
|
ROOT_ROLLUP,
|
|
13
18
|
|
|
14
19
|
BASE_PARITY,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SpongeBlob } from '@aztec/blob-lib';
|
|
1
|
+
import { SpongeBlob } from '@aztec/blob-lib/types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
4
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SpongeBlob } from '@aztec/blob-lib';
|
|
1
|
+
import { SpongeBlob } from '@aztec/blob-lib/types';
|
|
2
2
|
import { ARCHIVE_HEIGHT, MAX_CONTRACT_CLASS_LOGS_PER_TX } from '@aztec/constants';
|
|
3
3
|
import { makeTuple } from '@aztec/foundation/array';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
4
5
|
import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
6
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
6
7
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
@@ -127,6 +128,10 @@ export class PublicBaseRollupHints {
|
|
|
127
128
|
* Preimages to the kernel's contractClassLogsHashes.
|
|
128
129
|
*/
|
|
129
130
|
public contractClassLogsFields: Tuple<ContractClassLogFields, typeof MAX_CONTRACT_CLASS_LOGS_PER_TX>,
|
|
131
|
+
/**
|
|
132
|
+
* Identifier of the prover.
|
|
133
|
+
*/
|
|
134
|
+
public proverId: Fr,
|
|
130
135
|
) {}
|
|
131
136
|
|
|
132
137
|
static from(fields: FieldsOf<PublicBaseRollupHints>): PublicBaseRollupHints {
|
|
@@ -139,6 +144,7 @@ export class PublicBaseRollupHints {
|
|
|
139
144
|
fields.lastArchive,
|
|
140
145
|
fields.archiveRootMembershipWitness,
|
|
141
146
|
fields.contractClassLogsFields,
|
|
147
|
+
fields.proverId,
|
|
142
148
|
] as const;
|
|
143
149
|
}
|
|
144
150
|
|
|
@@ -165,6 +171,7 @@ export class PublicBaseRollupHints {
|
|
|
165
171
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
166
172
|
MembershipWitness.fromBuffer(reader, ARCHIVE_HEIGHT),
|
|
167
173
|
makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, () => reader.readObject(ContractClassLogFields)),
|
|
174
|
+
reader.readObject(Fr),
|
|
168
175
|
);
|
|
169
176
|
}
|
|
170
177
|
|
|
@@ -178,6 +185,7 @@ export class PublicBaseRollupHints {
|
|
|
178
185
|
AppendOnlyTreeSnapshot.empty(),
|
|
179
186
|
MembershipWitness.empty(ARCHIVE_HEIGHT),
|
|
180
187
|
makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ContractClassLogFields.empty),
|
|
188
|
+
Fr.ZERO,
|
|
181
189
|
);
|
|
182
190
|
}
|
|
183
191
|
}
|
|
@@ -12,14 +12,21 @@ export class BlockConstantData {
|
|
|
12
12
|
constructor(
|
|
13
13
|
/** Archive tree snapshot at the very beginning of the entire rollup. */
|
|
14
14
|
public lastArchive: AppendOnlyTreeSnapshot,
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* L1-to-L2 message tree snapshot after this block lands.
|
|
17
|
+
* For the first block in a checkpoint, this should be the snapshot after inserting the new l1-to-l2 message subtree
|
|
18
|
+
* into the last l1-to-l2 tree snapshot in `last_archive`.
|
|
19
|
+
* For subsequent blocks, this should match the snapshot of the previous block.
|
|
20
|
+
*/
|
|
21
|
+
public l1ToL2TreeSnapshot: AppendOnlyTreeSnapshot,
|
|
17
22
|
/** Root of the verification key tree. */
|
|
18
23
|
public vkTreeRoot: Fr,
|
|
19
24
|
/** Root of the protocol contract tree. */
|
|
20
25
|
public protocolContractTreeRoot: Fr,
|
|
21
26
|
/** Global variables for the block. */
|
|
22
27
|
public globalVariables: GlobalVariables,
|
|
28
|
+
/** Identifier of the prover. */
|
|
29
|
+
public proverId: Fr,
|
|
23
30
|
) {}
|
|
24
31
|
|
|
25
32
|
static from(fields: FieldsOf<BlockConstantData>): BlockConstantData {
|
|
@@ -34,16 +41,18 @@ export class BlockConstantData {
|
|
|
34
41
|
Fr.fromBuffer(reader),
|
|
35
42
|
Fr.fromBuffer(reader),
|
|
36
43
|
reader.readObject(GlobalVariables),
|
|
44
|
+
Fr.fromBuffer(reader),
|
|
37
45
|
);
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
static getFields(fields: FieldsOf<BlockConstantData>) {
|
|
41
49
|
return [
|
|
42
50
|
fields.lastArchive,
|
|
43
|
-
fields.
|
|
51
|
+
fields.l1ToL2TreeSnapshot,
|
|
44
52
|
fields.vkTreeRoot,
|
|
45
53
|
fields.protocolContractTreeRoot,
|
|
46
54
|
fields.globalVariables,
|
|
55
|
+
fields.proverId,
|
|
47
56
|
] as const;
|
|
48
57
|
}
|
|
49
58
|
|
|
@@ -54,6 +63,7 @@ export class BlockConstantData {
|
|
|
54
63
|
Fr.ZERO,
|
|
55
64
|
Fr.ZERO,
|
|
56
65
|
GlobalVariables.empty(),
|
|
66
|
+
Fr.ZERO,
|
|
57
67
|
);
|
|
58
68
|
}
|
|
59
69
|
|
|
@@ -2,17 +2,19 @@ import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
3
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { ProofData } from '../proofs/index.js';
|
|
6
|
+
import { BlockRollupPublicInputs } from './block_rollup_public_inputs.js';
|
|
7
|
+
import type { RollupProofData } from './rollup_proof_data.js';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Represents inputs of the block merge rollup circuit.
|
|
9
11
|
*/
|
|
10
|
-
export class
|
|
12
|
+
export class BlockMergeRollupPrivateInputs {
|
|
11
13
|
constructor(
|
|
12
14
|
/**
|
|
13
15
|
* Previous rollup data from the 2 block merge or block root rollup circuits that preceded this merge rollup circuit.
|
|
14
16
|
*/
|
|
15
|
-
public
|
|
17
|
+
public previousRollups: [RollupProofData<BlockRollupPublicInputs>, RollupProofData<BlockRollupPublicInputs>],
|
|
16
18
|
) {}
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -20,7 +22,7 @@ export class BlockMergeRollupInputs {
|
|
|
20
22
|
* @returns The inputs serialized to a buffer.
|
|
21
23
|
*/
|
|
22
24
|
toBuffer() {
|
|
23
|
-
return serializeToBuffer(this.
|
|
25
|
+
return serializeToBuffer(this.previousRollups);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -34,23 +36,23 @@ export class BlockMergeRollupInputs {
|
|
|
34
36
|
/**
|
|
35
37
|
* Deserializes the inputs from a buffer.
|
|
36
38
|
* @param buffer - The buffer to deserialize from.
|
|
37
|
-
* @returns A new
|
|
39
|
+
* @returns A new BlockMergeRollupPrivateInputs instance.
|
|
38
40
|
*/
|
|
39
41
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
40
42
|
const reader = BufferReader.asReader(buffer);
|
|
41
|
-
return new
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
return new BlockMergeRollupPrivateInputs([
|
|
44
|
+
ProofData.fromBuffer(reader, BlockRollupPublicInputs),
|
|
45
|
+
ProofData.fromBuffer(reader, BlockRollupPublicInputs),
|
|
44
46
|
]);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
/**
|
|
48
50
|
* Deserializes the inputs from a hex string.
|
|
49
51
|
* @param str - A hex string to deserialize from.
|
|
50
|
-
* @returns A new
|
|
52
|
+
* @returns A new BlockMergeRollupPrivateInputs instance.
|
|
51
53
|
*/
|
|
52
54
|
static fromString(str: string) {
|
|
53
|
-
return
|
|
55
|
+
return BlockMergeRollupPrivateInputs.fromBuffer(hexToBuffer(str));
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
/** Returns a hex representation for JSON serialization. */
|
|
@@ -60,6 +62,6 @@ export class BlockMergeRollupInputs {
|
|
|
60
62
|
|
|
61
63
|
/** Creates an instance from a hex string. */
|
|
62
64
|
static get schema() {
|
|
63
|
-
return bufferSchemaFor(
|
|
65
|
+
return bufferSchemaFor(BlockMergeRollupPrivateInputs);
|
|
64
66
|
}
|
|
65
67
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { SpongeBlob } from '@aztec/blob-lib/types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
4
|
+
import { BufferReader, bigintToUInt64BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
|
+
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
6
|
+
|
|
7
|
+
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
8
|
+
import { StateReference } from '../tx/state_reference.js';
|
|
9
|
+
import type { UInt64 } from '../types/shared.js';
|
|
10
|
+
import { CheckpointConstantData } from './checkpoint_constant_data.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Output of the block root and block merge rollup circuits.
|
|
14
|
+
*/
|
|
15
|
+
export class BlockRollupPublicInputs {
|
|
16
|
+
constructor(
|
|
17
|
+
/**
|
|
18
|
+
* Constants for the entire checkpoint.
|
|
19
|
+
*/
|
|
20
|
+
public constants: CheckpointConstantData,
|
|
21
|
+
/**
|
|
22
|
+
* Archive tree immediately before this block range.
|
|
23
|
+
*/
|
|
24
|
+
public previousArchive: AppendOnlyTreeSnapshot,
|
|
25
|
+
/**
|
|
26
|
+
* Archive tree after applying this block range.
|
|
27
|
+
*/
|
|
28
|
+
public newArchive: AppendOnlyTreeSnapshot,
|
|
29
|
+
/**
|
|
30
|
+
* State reference immediately before this block range.
|
|
31
|
+
*/
|
|
32
|
+
public startState: StateReference,
|
|
33
|
+
/**
|
|
34
|
+
* State reference after applying this block range.
|
|
35
|
+
*/
|
|
36
|
+
public endState: StateReference,
|
|
37
|
+
/**
|
|
38
|
+
* Sponge state to absorb blob inputs at the start of this block range.
|
|
39
|
+
*/
|
|
40
|
+
public startSpongeBlob: SpongeBlob,
|
|
41
|
+
/**
|
|
42
|
+
* Sponge state to absorb blob inputs at the end of this block range.
|
|
43
|
+
*/
|
|
44
|
+
public endSpongeBlob: SpongeBlob,
|
|
45
|
+
/**
|
|
46
|
+
* Timestamp of the first block in this block range.
|
|
47
|
+
*/
|
|
48
|
+
public startTimestamp: UInt64,
|
|
49
|
+
/**
|
|
50
|
+
* Timestamp of the last block in this block range.
|
|
51
|
+
*/
|
|
52
|
+
public endTimestamp: UInt64,
|
|
53
|
+
/**
|
|
54
|
+
* SHA256 hash of l1 to l2 messages.
|
|
55
|
+
*/
|
|
56
|
+
public inHash: Fr,
|
|
57
|
+
/**
|
|
58
|
+
* SHA256 hash of L2 to L1 messages created in this block range.
|
|
59
|
+
*/
|
|
60
|
+
public outHash: Fr,
|
|
61
|
+
/**
|
|
62
|
+
* The summed transaction fees of all the txs in this block range.
|
|
63
|
+
*/
|
|
64
|
+
public accumulatedFees: Fr,
|
|
65
|
+
/**
|
|
66
|
+
* The summed mana used of all the txs in this block range.
|
|
67
|
+
*/
|
|
68
|
+
public accumulatedManaUsed: Fr,
|
|
69
|
+
) {}
|
|
70
|
+
|
|
71
|
+
static fromBuffer(buffer: Buffer | BufferReader): BlockRollupPublicInputs {
|
|
72
|
+
const reader = BufferReader.asReader(buffer);
|
|
73
|
+
return new BlockRollupPublicInputs(
|
|
74
|
+
reader.readObject(CheckpointConstantData),
|
|
75
|
+
reader.readObject(AppendOnlyTreeSnapshot),
|
|
76
|
+
reader.readObject(AppendOnlyTreeSnapshot),
|
|
77
|
+
reader.readObject(StateReference),
|
|
78
|
+
reader.readObject(StateReference),
|
|
79
|
+
reader.readObject(SpongeBlob),
|
|
80
|
+
reader.readObject(SpongeBlob),
|
|
81
|
+
reader.readUInt64(),
|
|
82
|
+
reader.readUInt64(),
|
|
83
|
+
Fr.fromBuffer(reader),
|
|
84
|
+
Fr.fromBuffer(reader),
|
|
85
|
+
Fr.fromBuffer(reader),
|
|
86
|
+
Fr.fromBuffer(reader),
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
toBuffer() {
|
|
91
|
+
return serializeToBuffer(
|
|
92
|
+
this.constants,
|
|
93
|
+
this.previousArchive,
|
|
94
|
+
this.newArchive,
|
|
95
|
+
this.startState,
|
|
96
|
+
this.endState,
|
|
97
|
+
this.startSpongeBlob,
|
|
98
|
+
this.endSpongeBlob,
|
|
99
|
+
bigintToUInt64BE(this.startTimestamp),
|
|
100
|
+
bigintToUInt64BE(this.endTimestamp),
|
|
101
|
+
this.inHash,
|
|
102
|
+
this.outHash,
|
|
103
|
+
this.accumulatedFees,
|
|
104
|
+
this.accumulatedManaUsed,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
toString() {
|
|
109
|
+
return bufferToHex(this.toBuffer());
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static fromString(str: string) {
|
|
113
|
+
return BlockRollupPublicInputs.fromBuffer(hexToBuffer(str));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
toJSON() {
|
|
117
|
+
return this.toBuffer();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
static get schema() {
|
|
121
|
+
return bufferSchemaFor(BlockRollupPublicInputs);
|
|
122
|
+
}
|
|
123
|
+
}
|