@aztec/stdlib 3.0.0-nightly.20250917 → 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 +6 -0
- package/dest/avm/avm.d.ts.map +1 -1
- 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 +7 -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/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 +170 -61
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +101 -39
- 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/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 +15 -40
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +70 -78
- 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/package.json +8 -8
- 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/block-builder.ts +1 -6
- package/src/interfaces/epoch-prover.ts +34 -10
- package/src/interfaces/proving-job.ts +166 -51
- 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/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 +124 -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/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
|
@@ -13,11 +13,10 @@ import { z } from 'zod';
|
|
|
13
13
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
14
14
|
import { GasFees } from '../gas/index.js';
|
|
15
15
|
import { schemas } from '../schemas/index.js';
|
|
16
|
+
import { ContentCommitment } from '../tx/content_commitment.js';
|
|
16
17
|
import type { UInt64 } from '../types/shared.js';
|
|
17
|
-
import { ContentCommitment } from './content_commitment.js';
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
export class ProposedBlockHeader {
|
|
19
|
+
export class CheckpointHeader {
|
|
21
20
|
constructor(
|
|
22
21
|
/** Root of the archive tree before this block is added. */
|
|
23
22
|
public lastArchiveRoot: Fr,
|
|
@@ -37,7 +36,7 @@ export class ProposedBlockHeader {
|
|
|
37
36
|
public totalManaUsed: Fr,
|
|
38
37
|
) {}
|
|
39
38
|
|
|
40
|
-
static get schema(): ZodFor<
|
|
39
|
+
static get schema(): ZodFor<CheckpointHeader> {
|
|
41
40
|
return z
|
|
42
41
|
.object({
|
|
43
42
|
lastArchiveRoot: schemas.Fr,
|
|
@@ -49,10 +48,10 @@ export class ProposedBlockHeader {
|
|
|
49
48
|
gasFees: GasFees.schema,
|
|
50
49
|
totalManaUsed: schemas.Fr,
|
|
51
50
|
})
|
|
52
|
-
.transform(
|
|
51
|
+
.transform(CheckpointHeader.from);
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
static getFields(fields: FieldsOf<
|
|
54
|
+
static getFields(fields: FieldsOf<CheckpointHeader>) {
|
|
56
55
|
return [
|
|
57
56
|
fields.lastArchiveRoot,
|
|
58
57
|
fields.contentCommitment,
|
|
@@ -65,14 +64,14 @@ export class ProposedBlockHeader {
|
|
|
65
64
|
] as const;
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
static from(fields: FieldsOf<
|
|
69
|
-
return new
|
|
67
|
+
static from(fields: FieldsOf<CheckpointHeader>) {
|
|
68
|
+
return new CheckpointHeader(...CheckpointHeader.getFields(fields));
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
static fromBuffer(buffer: Buffer | BufferReader)
|
|
71
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
73
72
|
const reader = BufferReader.asReader(buffer);
|
|
74
73
|
|
|
75
|
-
return new
|
|
74
|
+
return new CheckpointHeader(
|
|
76
75
|
reader.readObject(Fr),
|
|
77
76
|
reader.readObject(ContentCommitment),
|
|
78
77
|
Fr.fromBuffer(reader),
|
|
@@ -102,8 +101,8 @@ export class ProposedBlockHeader {
|
|
|
102
101
|
return sha256ToField([this.toBuffer()]);
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
static empty(fields: Partial<FieldsOf<
|
|
106
|
-
return
|
|
104
|
+
static empty(fields: Partial<FieldsOf<CheckpointHeader>> = {}) {
|
|
105
|
+
return CheckpointHeader.from({
|
|
107
106
|
lastArchiveRoot: Fr.ZERO,
|
|
108
107
|
contentCommitment: ContentCommitment.empty(),
|
|
109
108
|
slotNumber: Fr.ZERO,
|
|
@@ -116,8 +115,8 @@ export class ProposedBlockHeader {
|
|
|
116
115
|
});
|
|
117
116
|
}
|
|
118
117
|
|
|
119
|
-
static random():
|
|
120
|
-
return new
|
|
118
|
+
static random(): CheckpointHeader {
|
|
119
|
+
return new CheckpointHeader(
|
|
121
120
|
Fr.random(),
|
|
122
121
|
ContentCommitment.random(),
|
|
123
122
|
new Fr(BigInt(Math.floor(Math.random() * 1000) + 1)),
|
|
@@ -150,12 +149,12 @@ export class ProposedBlockHeader {
|
|
|
150
149
|
return bufferToHex(this.toBuffer());
|
|
151
150
|
}
|
|
152
151
|
|
|
153
|
-
static fromString(str: string)
|
|
154
|
-
return
|
|
152
|
+
static fromString(str: string) {
|
|
153
|
+
return CheckpointHeader.fromBuffer(hexToBuffer(str));
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
static fromViem(header: ViemHeader) {
|
|
158
|
-
return new
|
|
157
|
+
return new CheckpointHeader(
|
|
159
158
|
Fr.fromString(header.lastArchiveRoot),
|
|
160
159
|
ContentCommitment.fromViem(header.contentCommitment),
|
|
161
160
|
new Fr(header.slotNumber),
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
2
|
+
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
+
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
4
|
+
|
|
5
|
+
import { ProofData } from '../proofs/proof_data.js';
|
|
6
|
+
import { CheckpointRollupPublicInputs } from './checkpoint_rollup_public_inputs.js';
|
|
7
|
+
import type { RollupProofData } from './rollup_proof_data.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents inputs of the checkpoint merge rollup circuit.
|
|
11
|
+
*/
|
|
12
|
+
export class CheckpointMergeRollupPrivateInputs {
|
|
13
|
+
constructor(
|
|
14
|
+
/**
|
|
15
|
+
* Previous rollup data from the 2 checkpoint root or merge rollup circuits that preceded this checkpoint merge rollup circuit.
|
|
16
|
+
*/
|
|
17
|
+
public previousRollups: [
|
|
18
|
+
RollupProofData<CheckpointRollupPublicInputs>,
|
|
19
|
+
RollupProofData<CheckpointRollupPublicInputs>,
|
|
20
|
+
],
|
|
21
|
+
) {}
|
|
22
|
+
|
|
23
|
+
toBuffer() {
|
|
24
|
+
return serializeToBuffer(this.previousRollups);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
28
|
+
const reader = BufferReader.asReader(buffer);
|
|
29
|
+
return new CheckpointMergeRollupPrivateInputs([
|
|
30
|
+
ProofData.fromBuffer(reader, CheckpointRollupPublicInputs),
|
|
31
|
+
ProofData.fromBuffer(reader, CheckpointRollupPublicInputs),
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
toString() {
|
|
36
|
+
return bufferToHex(this.toBuffer());
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static fromString(str: string) {
|
|
40
|
+
return CheckpointMergeRollupPrivateInputs.fromBuffer(hexToBuffer(str));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
toJSON() {
|
|
44
|
+
return this.toBuffer();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static get schema() {
|
|
48
|
+
return bufferSchemaFor(CheckpointMergeRollupPrivateInputs);
|
|
49
|
+
}
|
|
50
|
+
}
|
package/src/rollup/{block_root_or_block_merge_public_inputs.ts → checkpoint_rollup_public_inputs.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlobAccumulatorPublicInputs, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
2
|
import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -8,106 +8,80 @@ import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
|
8
8
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
9
9
|
|
|
10
10
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
11
|
-
import { GlobalVariables } from '../tx/global_variables.js';
|
|
12
11
|
import { EpochConstantData } from './epoch_constant_data.js';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
|
-
* Output of the
|
|
14
|
+
* Output of the checkpoint root and checkpoint merge rollup circuits.
|
|
16
15
|
*/
|
|
17
|
-
export class
|
|
16
|
+
export class CheckpointRollupPublicInputs {
|
|
18
17
|
constructor(
|
|
19
18
|
/**
|
|
20
19
|
* Constants for the entire epoch.
|
|
21
20
|
*/
|
|
22
21
|
public constants: EpochConstantData,
|
|
23
22
|
/**
|
|
24
|
-
* Archive tree immediately before this
|
|
23
|
+
* Archive tree immediately before this checkpoint range.
|
|
25
24
|
*/
|
|
26
25
|
public previousArchive: AppendOnlyTreeSnapshot,
|
|
27
26
|
/**
|
|
28
|
-
* Archive tree after adding this
|
|
27
|
+
* Archive tree after adding this checkpoint range.
|
|
29
28
|
*/
|
|
30
29
|
public newArchive: AppendOnlyTreeSnapshot,
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
31
|
+
* The hashes of the headers of the constituent checkpoints.
|
|
33
32
|
*/
|
|
34
|
-
public
|
|
33
|
+
public checkpointHeaderHashes: Tuple<Fr, typeof AZTEC_MAX_EPOCH_DURATION>,
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
35
|
+
* The summed transaction fees and recipients of the constituent checkpoints.
|
|
37
36
|
*/
|
|
38
|
-
public
|
|
39
|
-
/**
|
|
40
|
-
* SHA256 hash of L2 to L1 messages. Used to make public inputs constant-sized (to then be opened onchain).
|
|
41
|
-
* Note: Truncated to 31 bytes to fit in Fr.
|
|
42
|
-
*/
|
|
43
|
-
public outHash: Fr,
|
|
37
|
+
public fees: Tuple<FeeRecipient, typeof AZTEC_MAX_EPOCH_DURATION>,
|
|
44
38
|
/**
|
|
45
|
-
*
|
|
39
|
+
* Accumulated opening proofs for all blobs before this checkpoint range.
|
|
46
40
|
*/
|
|
47
|
-
public
|
|
41
|
+
public startBlobAccumulator: BlobAccumulatorPublicInputs,
|
|
48
42
|
/**
|
|
49
|
-
*
|
|
43
|
+
* Accumulated opening proofs for all blobs after applying this checkpoint range.
|
|
50
44
|
*/
|
|
51
|
-
public
|
|
45
|
+
public endBlobAccumulator: BlobAccumulatorPublicInputs,
|
|
52
46
|
/**
|
|
53
|
-
*
|
|
47
|
+
* Final values z and gamma, shared across the epoch.
|
|
54
48
|
*/
|
|
55
|
-
public
|
|
49
|
+
public finalBlobChallenges: FinalBlobBatchingChallenges,
|
|
56
50
|
) {}
|
|
57
51
|
|
|
58
|
-
|
|
59
|
-
* Deserializes from a buffer or reader.
|
|
60
|
-
* @param buffer - Buffer or reader to read from.
|
|
61
|
-
* @returns The deserialized public inputs.
|
|
62
|
-
*/
|
|
63
|
-
static fromBuffer(buffer: Buffer | BufferReader): BlockRootOrBlockMergePublicInputs {
|
|
52
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
64
53
|
const reader = BufferReader.asReader(buffer);
|
|
65
|
-
return new
|
|
54
|
+
return new CheckpointRollupPublicInputs(
|
|
66
55
|
reader.readObject(EpochConstantData),
|
|
67
56
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
68
57
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
69
|
-
reader.readObject(GlobalVariables),
|
|
70
|
-
reader.readObject(GlobalVariables),
|
|
71
|
-
Fr.fromBuffer(reader),
|
|
72
58
|
reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr),
|
|
73
59
|
reader.readArray(AZTEC_MAX_EPOCH_DURATION, FeeRecipient),
|
|
74
|
-
reader.readObject(
|
|
60
|
+
reader.readObject(BlobAccumulatorPublicInputs),
|
|
61
|
+
reader.readObject(BlobAccumulatorPublicInputs),
|
|
62
|
+
reader.readObject(FinalBlobBatchingChallenges),
|
|
75
63
|
);
|
|
76
64
|
}
|
|
77
65
|
|
|
78
|
-
/**
|
|
79
|
-
* Serialize this as a buffer.
|
|
80
|
-
* @returns The buffer.
|
|
81
|
-
*/
|
|
82
66
|
toBuffer() {
|
|
83
67
|
return serializeToBuffer(
|
|
84
68
|
this.constants,
|
|
85
69
|
this.previousArchive,
|
|
86
70
|
this.newArchive,
|
|
87
|
-
this.
|
|
88
|
-
this.endGlobalVariables,
|
|
89
|
-
this.outHash,
|
|
90
|
-
this.proposedBlockHeaderHashes,
|
|
71
|
+
this.checkpointHeaderHashes,
|
|
91
72
|
this.fees,
|
|
92
|
-
this.
|
|
73
|
+
this.startBlobAccumulator,
|
|
74
|
+
this.endBlobAccumulator,
|
|
75
|
+
this.finalBlobChallenges,
|
|
93
76
|
);
|
|
94
77
|
}
|
|
95
78
|
|
|
96
|
-
/**
|
|
97
|
-
* Serialize this as a hex string.
|
|
98
|
-
* @returns - The hex string.
|
|
99
|
-
*/
|
|
100
79
|
toString() {
|
|
101
80
|
return bufferToHex(this.toBuffer());
|
|
102
81
|
}
|
|
103
82
|
|
|
104
|
-
/**
|
|
105
|
-
* Deserializes from a hex string.
|
|
106
|
-
* @param str - A hex string to deserialize from.
|
|
107
|
-
* @returns A new BaseOrMergeRollupPublicInputs instance.
|
|
108
|
-
*/
|
|
109
83
|
static fromString(str: string) {
|
|
110
|
-
return
|
|
84
|
+
return CheckpointRollupPublicInputs.fromBuffer(hexToBuffer(str));
|
|
111
85
|
}
|
|
112
86
|
|
|
113
87
|
/** Returns a buffer representation for JSON serialization. */
|
|
@@ -117,7 +91,7 @@ export class BlockRootOrBlockMergePublicInputs {
|
|
|
117
91
|
|
|
118
92
|
/** Creates an instance from a hex string. */
|
|
119
93
|
static get schema() {
|
|
120
|
-
return bufferSchemaFor(
|
|
94
|
+
return bufferSchemaFor(CheckpointRollupPublicInputs);
|
|
121
95
|
}
|
|
122
96
|
}
|
|
123
97
|
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { BlobAccumulatorPublicInputs, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
|
+
import { ARCHIVE_HEIGHT, BLOBS_PER_BLOCK, FIELDS_PER_BLOB } from '@aztec/constants';
|
|
3
|
+
import { BLS12Point, Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
5
|
+
import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
6
|
+
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
7
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
8
|
+
|
|
9
|
+
import { ProofData } from '../proofs/proof_data.js';
|
|
10
|
+
import { BlockHeader } from '../tx/block_header.js';
|
|
11
|
+
import { BlockRollupPublicInputs } from './block_rollup_public_inputs.js';
|
|
12
|
+
import type { RollupProofData } from './rollup_proof_data.js';
|
|
13
|
+
|
|
14
|
+
export class CheckpointRootRollupHints {
|
|
15
|
+
constructor(
|
|
16
|
+
/**
|
|
17
|
+
* The header of the previous block before this checkpoint.
|
|
18
|
+
*/
|
|
19
|
+
public previousBlockHeader: BlockHeader,
|
|
20
|
+
/**
|
|
21
|
+
* Hint for checking the hash of previous_block_header is the last leaf of the previous archive.
|
|
22
|
+
*/
|
|
23
|
+
public previousArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
24
|
+
/**
|
|
25
|
+
* The current blob accumulation state across the epoch.
|
|
26
|
+
*/
|
|
27
|
+
public startBlobAccumulator: BlobAccumulatorPublicInputs,
|
|
28
|
+
/**
|
|
29
|
+
* Finalized challenges z and gamma for performing blob batching. Shared value across the epoch.
|
|
30
|
+
*/
|
|
31
|
+
public finalBlobChallenges: FinalBlobBatchingChallenges,
|
|
32
|
+
/**
|
|
33
|
+
* Flat list of all tx effects which will be added to the blob.
|
|
34
|
+
* Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
|
|
35
|
+
* Tuple<Fr, FIELDS_PER_BLOB * BLOBS_PER_BLOCK>
|
|
36
|
+
*/
|
|
37
|
+
public blobFields: Fr[],
|
|
38
|
+
/**
|
|
39
|
+
* KZG commitments representing the blob (precomputed in ts, injected to use inside circuit).
|
|
40
|
+
*/
|
|
41
|
+
public blobCommitments: Tuple<BLS12Point, typeof BLOBS_PER_BLOCK>,
|
|
42
|
+
/**
|
|
43
|
+
* The hash of eth blob hashes for this block
|
|
44
|
+
* See yarn-project/foundation/src/blob/index.ts or body.ts for calculation
|
|
45
|
+
*/
|
|
46
|
+
public blobsHash: Fr,
|
|
47
|
+
) {}
|
|
48
|
+
|
|
49
|
+
static from(fields: FieldsOf<CheckpointRootRollupHints>) {
|
|
50
|
+
return new CheckpointRootRollupHints(...CheckpointRootRollupHints.getFields(fields));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static getFields(fields: FieldsOf<CheckpointRootRollupHints>) {
|
|
54
|
+
return [
|
|
55
|
+
fields.previousBlockHeader,
|
|
56
|
+
fields.previousArchiveSiblingPath,
|
|
57
|
+
fields.startBlobAccumulator,
|
|
58
|
+
fields.finalBlobChallenges,
|
|
59
|
+
fields.blobFields,
|
|
60
|
+
fields.blobCommitments,
|
|
61
|
+
fields.blobsHash,
|
|
62
|
+
] as const;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
toBuffer() {
|
|
66
|
+
return serializeToBuffer(...CheckpointRootRollupHints.getFields(this));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
70
|
+
const reader = BufferReader.asReader(buffer);
|
|
71
|
+
return new CheckpointRootRollupHints(
|
|
72
|
+
BlockHeader.fromBuffer(reader),
|
|
73
|
+
reader.readArray(ARCHIVE_HEIGHT, Fr),
|
|
74
|
+
reader.readObject(BlobAccumulatorPublicInputs),
|
|
75
|
+
reader.readObject(FinalBlobBatchingChallenges),
|
|
76
|
+
// Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
|
|
77
|
+
// reader.readArray(FIELDS_PER_BLOB, Fr),
|
|
78
|
+
Array.from({ length: FIELDS_PER_BLOB * BLOBS_PER_BLOCK }, () => Fr.fromBuffer(reader)),
|
|
79
|
+
reader.readArray(BLOBS_PER_BLOCK, BLS12Point),
|
|
80
|
+
Fr.fromBuffer(reader),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
toString() {
|
|
85
|
+
return bufferToHex(this.toBuffer());
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static fromString(str: string) {
|
|
89
|
+
return CheckpointRootRollupHints.fromBuffer(hexToBuffer(str));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
toJSON() {
|
|
93
|
+
return this.toBuffer();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static get schema() {
|
|
97
|
+
return bufferSchemaFor(CheckpointRootRollupHints);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export class CheckpointRootRollupPrivateInputs {
|
|
102
|
+
constructor(
|
|
103
|
+
public previousRollups: [RollupProofData<BlockRollupPublicInputs>, RollupProofData<BlockRollupPublicInputs>],
|
|
104
|
+
public hints: CheckpointRootRollupHints,
|
|
105
|
+
) {}
|
|
106
|
+
|
|
107
|
+
static from(fields: FieldsOf<CheckpointRootRollupPrivateInputs>) {
|
|
108
|
+
return new CheckpointRootRollupPrivateInputs(...CheckpointRootRollupPrivateInputs.getFields(fields));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
static getFields(fields: FieldsOf<CheckpointRootRollupPrivateInputs>) {
|
|
112
|
+
return [fields.previousRollups, fields.hints] as const;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
toBuffer() {
|
|
116
|
+
return serializeToBuffer(...CheckpointRootRollupPrivateInputs.getFields(this));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
120
|
+
const reader = BufferReader.asReader(buffer);
|
|
121
|
+
return new CheckpointRootRollupPrivateInputs(
|
|
122
|
+
[ProofData.fromBuffer(reader, BlockRollupPublicInputs), ProofData.fromBuffer(reader, BlockRollupPublicInputs)],
|
|
123
|
+
CheckpointRootRollupHints.fromBuffer(reader),
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
toString() {
|
|
128
|
+
return bufferToHex(this.toBuffer());
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static fromString(str: string) {
|
|
132
|
+
return CheckpointRootRollupPrivateInputs.fromBuffer(hexToBuffer(str));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
toJSON() {
|
|
136
|
+
return this.toBuffer();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
static get schema() {
|
|
140
|
+
return bufferSchemaFor(CheckpointRootRollupPrivateInputs);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export class CheckpointRootSingleBlockRollupPrivateInputs {
|
|
145
|
+
constructor(
|
|
146
|
+
public previousRollup: RollupProofData<BlockRollupPublicInputs>,
|
|
147
|
+
public hints: CheckpointRootRollupHints,
|
|
148
|
+
) {}
|
|
149
|
+
|
|
150
|
+
static from(fields: FieldsOf<CheckpointRootSingleBlockRollupPrivateInputs>) {
|
|
151
|
+
return new CheckpointRootSingleBlockRollupPrivateInputs(
|
|
152
|
+
...CheckpointRootSingleBlockRollupPrivateInputs.getFields(fields),
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static getFields(fields: FieldsOf<CheckpointRootSingleBlockRollupPrivateInputs>) {
|
|
157
|
+
return [fields.previousRollup, fields.hints] as const;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
toBuffer() {
|
|
161
|
+
return serializeToBuffer(...CheckpointRootSingleBlockRollupPrivateInputs.getFields(this));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
165
|
+
const reader = BufferReader.asReader(buffer);
|
|
166
|
+
return new CheckpointRootSingleBlockRollupPrivateInputs(
|
|
167
|
+
ProofData.fromBuffer(reader, BlockRollupPublicInputs),
|
|
168
|
+
CheckpointRootRollupHints.fromBuffer(reader),
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
toString() {
|
|
173
|
+
return bufferToHex(this.toBuffer());
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
static fromString(str: string) {
|
|
177
|
+
return CheckpointRootSingleBlockRollupPrivateInputs.fromBuffer(hexToBuffer(str));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
toJSON() {
|
|
181
|
+
return this.toBuffer();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
static get schema() {
|
|
185
|
+
return bufferSchemaFor(CheckpointRootSingleBlockRollupPrivateInputs);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Checkpoint padding circuit does not have any private inputs.
|
|
190
|
+
export class CheckpointPaddingRollupPrivateInputs {
|
|
191
|
+
constructor() {}
|
|
192
|
+
|
|
193
|
+
toBuffer() {
|
|
194
|
+
return Buffer.alloc(0);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
static fromBuffer(_buffer: Buffer | BufferReader) {
|
|
198
|
+
return new CheckpointPaddingRollupPrivateInputs();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
toString(): `0x${string}` {
|
|
202
|
+
return '0x';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
static fromString(_str: string) {
|
|
206
|
+
return new CheckpointPaddingRollupPrivateInputs();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
toJSON() {
|
|
210
|
+
return this.toBuffer();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
static get schema() {
|
|
214
|
+
return bufferSchemaFor(CheckpointPaddingRollupPrivateInputs);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
2
|
+
import { BufferReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
3
3
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,6 +7,14 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
7
7
|
*/
|
|
8
8
|
export class EpochConstantData {
|
|
9
9
|
constructor(
|
|
10
|
+
/**
|
|
11
|
+
* ChainId of the rollup.
|
|
12
|
+
*/
|
|
13
|
+
public chainId: Fr,
|
|
14
|
+
/**
|
|
15
|
+
* Version of the rollup.
|
|
16
|
+
*/
|
|
17
|
+
public version: Fr,
|
|
10
18
|
/**
|
|
11
19
|
* Root of the verification key tree.
|
|
12
20
|
*/
|
|
@@ -25,20 +33,36 @@ export class EpochConstantData {
|
|
|
25
33
|
return new EpochConstantData(...EpochConstantData.getFields(fields));
|
|
26
34
|
}
|
|
27
35
|
|
|
28
|
-
static
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
static getFields(fields: FieldsOf<EpochConstantData>) {
|
|
37
|
+
return [
|
|
38
|
+
fields.chainId,
|
|
39
|
+
fields.version,
|
|
40
|
+
fields.vkTreeRoot,
|
|
41
|
+
fields.protocolContractTreeRoot,
|
|
42
|
+
fields.proverId,
|
|
43
|
+
] as const;
|
|
31
44
|
}
|
|
32
45
|
|
|
33
|
-
|
|
34
|
-
return
|
|
46
|
+
toFields(): Fr[] {
|
|
47
|
+
return serializeToFields(...EpochConstantData.getFields(this));
|
|
35
48
|
}
|
|
36
49
|
|
|
37
|
-
static
|
|
38
|
-
|
|
50
|
+
static fromBuffer(buffer: Buffer | BufferReader): EpochConstantData {
|
|
51
|
+
const reader = BufferReader.asReader(buffer);
|
|
52
|
+
return new EpochConstantData(
|
|
53
|
+
Fr.fromBuffer(reader),
|
|
54
|
+
Fr.fromBuffer(reader),
|
|
55
|
+
Fr.fromBuffer(reader),
|
|
56
|
+
Fr.fromBuffer(reader),
|
|
57
|
+
Fr.fromBuffer(reader),
|
|
58
|
+
);
|
|
39
59
|
}
|
|
40
60
|
|
|
41
61
|
toBuffer() {
|
|
42
62
|
return serializeToBuffer(...EpochConstantData.getFields(this));
|
|
43
63
|
}
|
|
64
|
+
|
|
65
|
+
static empty() {
|
|
66
|
+
return new EpochConstantData(Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO);
|
|
67
|
+
}
|
|
44
68
|
}
|
package/src/rollup/index.ts
CHANGED
|
@@ -3,16 +3,19 @@ export * from './base_or_merge_rollup_public_inputs.js';
|
|
|
3
3
|
export * from './base_rollup_hints.js';
|
|
4
4
|
export * from './block_constant_data.js';
|
|
5
5
|
export * from './block_merge_rollup.js';
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './empty_block_root_rollup_inputs.js';
|
|
8
|
-
export * from './epoch_constant_data.js';
|
|
6
|
+
export * from './block_rollup_public_inputs.js';
|
|
9
7
|
export * from './block_root_rollup.js';
|
|
8
|
+
export * from './checkpoint_constant_data.js';
|
|
9
|
+
export * from './checkpoint_header.js';
|
|
10
|
+
export * from './checkpoint_merge_rollup.js';
|
|
11
|
+
export * from './checkpoint_rollup_public_inputs.js';
|
|
12
|
+
export * from './checkpoint_root_rollup.js';
|
|
13
|
+
export * from './epoch_constant_data.js';
|
|
10
14
|
export * from './merge_rollup.js';
|
|
11
|
-
export * from './padding_block_root_rollup_inputs.js';
|
|
12
|
-
export * from './previous_rollup_block_data.js';
|
|
13
15
|
export * from './previous_rollup_data.js';
|
|
14
16
|
export * from './private_base_rollup_inputs.js';
|
|
15
17
|
export * from './public_base_rollup_inputs.js';
|
|
18
|
+
export * from './rollup_proof_data.js';
|
|
16
19
|
export * from './public_tube_private_inputs.js';
|
|
17
20
|
export * from './root_rollup.js';
|
|
18
21
|
export * from './state_diff_hints.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
|
+
import type { Bufferable } from '@aztec/foundation/serialize';
|
|
3
|
+
|
|
4
|
+
import type { ParityPublicInputs } from '../parity/index.js';
|
|
5
|
+
import { ProofData } from '../proofs/index.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents the data of a nested recursive rollup proof.
|
|
9
|
+
*/
|
|
10
|
+
export type RollupProofData<T extends Bufferable> = ProofData<T, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>;
|
|
11
|
+
|
|
12
|
+
export type RootParityProofData = ProofData<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>;
|