@aztec/stdlib 0.87.6 → 1.0.0-nightly.20250604
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/abi/abi.d.ts +3 -0
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +38 -0
- package/dest/avm/avm.d.ts +1188 -25
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +31 -14
- package/dest/avm/avm_accumulated_data.d.ts +77 -0
- package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.js +67 -0
- package/dest/avm/avm_circuit_public_inputs.d.ts +73 -3
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +19 -9
- package/dest/avm/avm_proving_request.d.ts +572 -0
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/avm/gas.d.ts +7 -0
- package/dest/avm/gas.d.ts.map +1 -0
- package/dest/avm/gas.js +13 -0
- package/dest/avm/index.d.ts +1 -0
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +1 -0
- package/dest/block/body.d.ts +1 -1
- package/dest/block/body.d.ts.map +1 -1
- package/dest/block/body.js +2 -2
- 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 +3 -2
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +10 -5
- package/dest/block/l2_block_source.d.ts +9 -4
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +1 -0
- package/dest/block/proposal/committee_attestation.d.ts +34 -0
- package/dest/block/proposal/committee_attestation.d.ts.map +1 -0
- package/dest/block/proposal/committee_attestation.js +59 -0
- package/dest/block/proposal/index.d.ts +2 -0
- package/dest/block/proposal/index.d.ts.map +1 -0
- package/dest/block/proposal/index.js +1 -0
- package/dest/block/published_l2_block.d.ts +99 -69
- package/dest/block/published_l2_block.d.ts.map +1 -1
- package/dest/block/published_l2_block.js +38 -12
- package/dest/block/test/l2_tips_store_test_suite.js +1 -1
- package/dest/interfaces/archiver.js +2 -2
- package/dest/interfaces/aztec-node.d.ts +3 -8
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +3 -6
- package/dest/interfaces/block-builder.d.ts +41 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +1 -1
- package/dest/interfaces/epoch-prover.d.ts +2 -2
- package/dest/interfaces/epoch-prover.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +14 -0
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/p2p.d.ts +6 -3
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +1 -2
- package/dest/interfaces/proving-job.d.ts +576 -4
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +2 -2
- package/dest/interfaces/server_circuit_prover.d.ts +3 -2
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +1 -1
- package/dest/kernel/hints/key_validation_hint.d.ts +2 -6
- package/dest/kernel/hints/key_validation_hint.d.ts.map +1 -1
- package/dest/kernel/hints/key_validation_hint.js +5 -7
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts +7 -7
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
- package/dest/kernel/hints/private_kernel_reset_hints.js +8 -4
- package/dest/kernel/hints/read_request_hints.d.ts +8 -8
- package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
- package/dest/kernel/index.d.ts +1 -0
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -0
- package/dest/kernel/padded_side_effects.d.ts +26 -0
- package/dest/kernel/padded_side_effects.d.ts.map +1 -0
- package/dest/kernel/padded_side_effects.js +51 -0
- package/dest/kernel/private_kernel_data.d.ts +6 -25
- package/dest/kernel/private_kernel_data.d.ts.map +1 -1
- package/dest/kernel/private_kernel_data.js +8 -19
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts +7 -4
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.js +10 -6
- package/dest/kernel/private_kernel_reset_dimensions.d.ts +10 -10
- package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_dimensions.js +29 -29
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +8 -3
- package/dest/kernel/private_to_avm_accumulated_data.d.ts +1 -0
- package/dest/kernel/private_to_avm_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_to_avm_accumulated_data.js +4 -0
- package/dest/kernel/public_call_request.d.ts +54 -0
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +58 -0
- package/dest/logs/contract_class_log.d.ts +0 -4
- package/dest/logs/contract_class_log.d.ts.map +1 -1
- package/dest/logs/contract_class_log.js +0 -33
- package/dest/logs/log_with_tx_data.d.ts +13 -3
- package/dest/logs/log_with_tx_data.d.ts.map +1 -1
- package/dest/logs/log_with_tx_data.js +26 -14
- package/dest/logs/private_log.d.ts +1 -0
- package/dest/logs/private_log.d.ts.map +1 -1
- package/dest/logs/private_log.js +3 -0
- package/dest/logs/public_log.d.ts +1 -0
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +3 -0
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +1 -0
- package/dest/messaging/index.d.ts +1 -0
- package/dest/messaging/index.d.ts.map +1 -1
- package/dest/messaging/index.js +1 -0
- package/dest/messaging/l2_to_l1_membership.d.ts +11 -0
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -0
- package/dest/messaging/l2_to_l1_membership.js +70 -0
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/rollup/avm_proof_data.d.ts +7 -5
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/avm_proof_data.js +12 -4
- package/dest/rollup/base_rollup_hints.d.ts +4 -4
- package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
- package/dest/rollup/base_rollup_hints.js +8 -8
- package/dest/rollup/previous_rollup_block_data.d.ts +6 -15
- package/dest/rollup/previous_rollup_block_data.d.ts.map +1 -1
- package/dest/rollup/previous_rollup_block_data.js +8 -13
- package/dest/rollup/previous_rollup_data.d.ts +6 -15
- package/dest/rollup/previous_rollup_data.d.ts.map +1 -1
- package/dest/rollup/previous_rollup_data.js +8 -13
- package/dest/rollup/private_tube_data.d.ts +3 -3
- package/dest/rollup/private_tube_data.d.ts.map +1 -1
- package/dest/rollup/private_tube_data.js +3 -3
- package/dest/rollup/public_tube_data.d.ts +3 -3
- package/dest/rollup/public_tube_data.d.ts.map +1 -1
- package/dest/rollup/public_tube_data.js +3 -3
- package/dest/rollup/root_rollup.d.ts +9 -10
- package/dest/rollup/root_rollup.d.ts.map +1 -1
- package/dest/rollup/root_rollup.js +9 -20
- package/dest/tests/factories.d.ts +2 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +53 -28
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +4 -3
- package/dest/tx/processed_tx.d.ts.map +1 -1
- package/dest/tx/processed_tx.js +2 -5
- package/dest/tx/tx.d.ts +10 -25
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +25 -50
- package/dest/tx/tx_effect.d.ts +1 -1
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +2 -2
- package/dest/tx/tx_hash.d.ts +1 -0
- package/dest/tx/tx_hash.d.ts.map +1 -1
- package/dest/tx/tx_hash.js +3 -0
- package/dest/validators/types.d.ts +4 -0
- package/dest/validators/types.d.ts.map +1 -1
- package/dest/vks/index.d.ts +1 -1
- package/dest/vks/index.d.ts.map +1 -1
- package/dest/vks/index.js +1 -1
- package/dest/vks/{vk_witness_data.d.ts → vk_data.d.ts} +8 -8
- package/dest/vks/vk_data.d.ts.map +1 -0
- package/dest/vks/{vk_witness_data.js → vk_data.js} +10 -10
- package/package.json +7 -7
- package/src/abi/abi.ts +37 -0
- package/src/avm/avm.ts +25 -4
- package/src/avm/avm_accumulated_data.ts +93 -0
- package/src/avm/avm_circuit_public_inputs.ts +22 -2
- package/src/avm/gas.ts +26 -0
- package/src/avm/index.ts +1 -0
- package/src/block/body.ts +7 -2
- package/src/block/index.ts +1 -0
- package/src/block/l2_block.ts +8 -3
- package/src/block/l2_block_source.ts +9 -3
- package/src/block/proposal/committee_attestation.ts +70 -0
- package/src/block/proposal/index.ts +1 -0
- package/src/block/published_l2_block.ts +38 -24
- package/src/block/test/l2_tips_store_test_suite.ts +1 -1
- package/src/interfaces/archiver.ts +2 -2
- package/src/interfaces/aztec-node.ts +8 -16
- package/src/interfaces/block-builder.ts +49 -2
- package/src/interfaces/epoch-prover.ts +2 -2
- package/src/interfaces/merkle_tree_operations.ts +20 -0
- package/src/interfaces/p2p.ts +9 -4
- package/src/interfaces/proving-job.ts +3 -3
- package/src/interfaces/server_circuit_prover.ts +3 -2
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +3 -3
- package/src/kernel/hints/key_validation_hint.ts +4 -6
- package/src/kernel/hints/private_kernel_reset_hints.ts +34 -43
- package/src/kernel/hints/read_request_hints.ts +27 -15
- package/src/kernel/index.ts +1 -0
- package/src/kernel/padded_side_effects.ts +73 -0
- package/src/kernel/private_kernel_data.ts +7 -29
- package/src/kernel/private_kernel_reset_circuit_private_inputs.ts +16 -13
- package/src/kernel/private_kernel_reset_dimensions.ts +27 -27
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +10 -2
- package/src/kernel/private_to_avm_accumulated_data.ts +9 -0
- package/src/kernel/public_call_request.ts +66 -0
- package/src/logs/contract_class_log.ts +0 -36
- package/src/logs/log_with_tx_data.ts +26 -12
- package/src/logs/private_log.ts +4 -0
- package/src/logs/public_log.ts +4 -0
- package/src/logs/tx_scoped_l2_log.ts +1 -0
- package/src/messaging/index.ts +1 -0
- package/src/messaging/l2_to_l1_membership.ts +113 -0
- package/src/p2p/consensus_payload.ts +3 -1
- package/src/rollup/avm_proof_data.ts +14 -7
- package/src/rollup/base_rollup_hints.ts +4 -4
- package/src/rollup/previous_rollup_block_data.ts +6 -12
- package/src/rollup/previous_rollup_data.ts +6 -12
- package/src/rollup/private_tube_data.ts +4 -4
- package/src/rollup/public_tube_data.ts +4 -4
- package/src/rollup/root_rollup.ts +6 -19
- package/src/tests/factories.ts +80 -43
- package/src/tests/mocks.ts +6 -3
- package/src/tx/processed_tx.ts +4 -5
- package/src/tx/tx.ts +28 -54
- package/src/tx/tx_effect.ts +23 -5
- package/src/tx/tx_hash.ts +4 -0
- package/src/validators/types.ts +2 -0
- package/src/vks/index.ts +1 -1
- package/src/vks/{vk_witness_data.ts → vk_data.ts} +6 -6
- package/dest/vks/vk_witness_data.d.ts.map +0 -1
|
@@ -22,6 +22,7 @@ import { z } from 'zod';
|
|
|
22
22
|
|
|
23
23
|
import { ScopedL2ToL1Message } from '../messaging/l2_to_l1_message.js';
|
|
24
24
|
import type { UInt32 } from '../types/shared.js';
|
|
25
|
+
import { countAccumulatedItems } from './utils/index.js';
|
|
25
26
|
|
|
26
27
|
export class PrivateToAvmAccumulatedData {
|
|
27
28
|
constructor(
|
|
@@ -55,6 +56,14 @@ export class PrivateToAvmAccumulatedData {
|
|
|
55
56
|
);
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
getArrayLengths() {
|
|
60
|
+
return new PrivateToAvmAccumulatedDataArrayLengths(
|
|
61
|
+
countAccumulatedItems(this.noteHashes),
|
|
62
|
+
countAccumulatedItems(this.nullifiers),
|
|
63
|
+
countAccumulatedItems(this.l2ToL1Msgs),
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
58
67
|
static getFields(fields: FieldsOf<PrivateToAvmAccumulatedData>) {
|
|
59
68
|
return [fields.noteHashes, fields.nullifiers, fields.l2ToL1Msgs] as const;
|
|
60
69
|
}
|
|
@@ -123,6 +123,72 @@ export class PublicCallRequest {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Represents lengths of arrays of public call requests.
|
|
128
|
+
*/
|
|
129
|
+
export class PublicCallRequestArrayLengths {
|
|
130
|
+
constructor(
|
|
131
|
+
/**
|
|
132
|
+
* Number of setup call requests
|
|
133
|
+
*/
|
|
134
|
+
public setupCalls: number,
|
|
135
|
+
/**
|
|
136
|
+
* Number of app logic call requests
|
|
137
|
+
*/
|
|
138
|
+
public appLogicCalls: number,
|
|
139
|
+
/**
|
|
140
|
+
* Whether there is a teardown call request
|
|
141
|
+
*/
|
|
142
|
+
public teardownCall: boolean,
|
|
143
|
+
) {}
|
|
144
|
+
|
|
145
|
+
static get schema() {
|
|
146
|
+
return z
|
|
147
|
+
.object({
|
|
148
|
+
setupCalls: z.number(),
|
|
149
|
+
appLogicCalls: z.number(),
|
|
150
|
+
teardownCall: z.boolean(),
|
|
151
|
+
})
|
|
152
|
+
.transform(({ setupCalls, appLogicCalls, teardownCall }) => {
|
|
153
|
+
return new PublicCallRequestArrayLengths(setupCalls, appLogicCalls, teardownCall);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static getFields(fields: FieldsOf<PublicCallRequestArrayLengths>) {
|
|
158
|
+
return [fields.setupCalls, fields.appLogicCalls, fields.teardownCall] as const;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
static fromFields(fields: Fr[] | FieldReader): PublicCallRequestArrayLengths {
|
|
162
|
+
const reader = FieldReader.asReader(fields);
|
|
163
|
+
return new PublicCallRequestArrayLengths(reader.readU32(), reader.readU32(), reader.readBoolean());
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
toFields(): Fr[] {
|
|
167
|
+
return serializeToFields(...PublicCallRequestArrayLengths.getFields(this));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
171
|
+
const reader = BufferReader.asReader(buffer);
|
|
172
|
+
return new PublicCallRequestArrayLengths(reader.readNumber(), reader.readNumber(), reader.readBoolean());
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
toBuffer() {
|
|
176
|
+
return serializeToBuffer(...PublicCallRequestArrayLengths.getFields(this));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static empty() {
|
|
180
|
+
return new PublicCallRequestArrayLengths(0, 0, false);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
[inspect.custom]() {
|
|
184
|
+
return `PublicCallRequestArrayLengths {
|
|
185
|
+
setupCalls: ${this.setupCalls}
|
|
186
|
+
appLogicCalls: ${this.appLogicCalls}
|
|
187
|
+
teardownCall: ${this.teardownCall}
|
|
188
|
+
}`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
126
192
|
export class CountedPublicCallRequest {
|
|
127
193
|
constructor(
|
|
128
194
|
public inner: PublicCallRequest,
|
|
@@ -96,8 +96,6 @@ export class ContractClassLogFields {
|
|
|
96
96
|
|
|
97
97
|
export class ContractClassLog {
|
|
98
98
|
static SIZE_IN_BYTES = Fr.SIZE_IN_BYTES * CONTRACT_CLASS_LOG_LENGTH;
|
|
99
|
-
// Keeps original first field pre-siloing. Only set by silo().
|
|
100
|
-
public unsiloedFirstField?: Fr | undefined;
|
|
101
99
|
|
|
102
100
|
constructor(
|
|
103
101
|
public contractAddress: AztecAddress,
|
|
@@ -180,40 +178,6 @@ export class ContractClassLog {
|
|
|
180
178
|
);
|
|
181
179
|
}
|
|
182
180
|
|
|
183
|
-
setUnsiloedFirstField(field: Fr) {
|
|
184
|
-
this.unsiloedFirstField = field;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
toUnsiloed() {
|
|
188
|
-
if (this.contractAddress.isZero()) {
|
|
189
|
-
return this;
|
|
190
|
-
}
|
|
191
|
-
if (this.unsiloedFirstField) {
|
|
192
|
-
return new ContractClassLog(
|
|
193
|
-
this.contractAddress,
|
|
194
|
-
new ContractClassLogFields([this.unsiloedFirstField].concat(this.fields.fields.slice(1))),
|
|
195
|
-
this.emittedLength,
|
|
196
|
-
);
|
|
197
|
-
} else {
|
|
198
|
-
return this;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// TODO(#13914): Don't need to silo the contract class logs.
|
|
203
|
-
async silo() {
|
|
204
|
-
if (this.contractAddress.isZero()) {
|
|
205
|
-
return this;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const fields = this.fields.clone();
|
|
209
|
-
const unsiloedField = fields.fields[0];
|
|
210
|
-
const siloedField = await poseidon2Hash([this.contractAddress, unsiloedField]);
|
|
211
|
-
fields.fields[0] = siloedField;
|
|
212
|
-
const cloned = new ContractClassLog(this.contractAddress, fields, this.emittedLength);
|
|
213
|
-
cloned.setUnsiloedFirstField(unsiloedField);
|
|
214
|
-
return cloned;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
181
|
async hash() {
|
|
218
182
|
return await this.fields.hash();
|
|
219
183
|
}
|
|
@@ -1,33 +1,47 @@
|
|
|
1
|
-
import { MAX_NOTE_HASHES_PER_TX,
|
|
1
|
+
import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN, PUBLIC_LOG_PLAINTEXT_LEN } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
|
-
// TypeScript representation of the Noir aztec::oracle::
|
|
6
|
-
// response for PXE's custom
|
|
7
|
-
|
|
5
|
+
// TypeScript representation of the Noir aztec::oracle::message_processing::LogWithTxData<N> struct. This is used as a
|
|
6
|
+
// response for PXE's custom getPublicLogByTag and getPrivateLogByTag oracles.
|
|
7
|
+
class LogWithTxData<N extends number> {
|
|
8
8
|
constructor(
|
|
9
|
-
|
|
10
|
-
// For public logs, the contract address is prepended to the content.
|
|
11
|
-
public logContent: Fr[],
|
|
9
|
+
public logPayload: Fr[],
|
|
12
10
|
public txHash: TxHash,
|
|
13
11
|
public uniqueNoteHashesInTx: Fr[],
|
|
14
12
|
public firstNullifierInTx: Fr,
|
|
13
|
+
private maxLogContentLength: N,
|
|
15
14
|
) {}
|
|
16
15
|
|
|
17
16
|
toNoirSerialization(): (Fr | Fr[])[] {
|
|
18
17
|
return [
|
|
19
|
-
|
|
20
|
-
// This is only used for public logs currently, so the maxLength is PUBLIC_LOG_SIZE_IN_FIELDS + 1.
|
|
21
|
-
// TODO(#11639): this could also be used for private logs.
|
|
22
|
-
...toBoundedVecSerialization(this.logContent, PUBLIC_LOG_SIZE_IN_FIELDS + 1),
|
|
18
|
+
...toBoundedVecSerialization(this.logPayload, this.maxLogContentLength),
|
|
23
19
|
this.txHash.hash,
|
|
24
20
|
...toBoundedVecSerialization(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
|
|
25
21
|
this.firstNullifierInTx,
|
|
26
22
|
];
|
|
27
23
|
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// This is used as a response for PXE's custom getPublicLogByTag oracle.
|
|
27
|
+
export class PublicLogWithTxData extends LogWithTxData<typeof PUBLIC_LOG_PLAINTEXT_LEN> {
|
|
28
|
+
constructor(logContent: Fr[], txHash: TxHash, uniqueNoteHashesInTx: Fr[], firstNullifierInTx: Fr) {
|
|
29
|
+
super(logContent, txHash, uniqueNoteHashesInTx, firstNullifierInTx, PUBLIC_LOG_PLAINTEXT_LEN);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static noirSerializationOfEmpty(): (Fr | Fr[])[] {
|
|
33
|
+
return new PublicLogWithTxData([], TxHash.zero(), [], new Fr(0)).toNoirSerialization();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// This is used as a response for PXE's custom getPrivateLogByTag oracle.
|
|
38
|
+
export class PrivateLogWithTxData extends LogWithTxData<typeof PRIVATE_LOG_CIPHERTEXT_LEN> {
|
|
39
|
+
constructor(logContent: Fr[], txHash: TxHash, uniqueNoteHashesInTx: Fr[], firstNullifierInTx: Fr) {
|
|
40
|
+
super(logContent, txHash, uniqueNoteHashesInTx, firstNullifierInTx, PRIVATE_LOG_CIPHERTEXT_LEN);
|
|
41
|
+
}
|
|
28
42
|
|
|
29
43
|
static noirSerializationOfEmpty(): (Fr | Fr[])[] {
|
|
30
|
-
return new
|
|
44
|
+
return new PrivateLogWithTxData([], TxHash.zero(), [], new Fr(0)).toNoirSerialization();
|
|
31
45
|
}
|
|
32
46
|
}
|
|
33
47
|
|
package/src/logs/private_log.ts
CHANGED
|
@@ -44,6 +44,10 @@ export class PrivateLog {
|
|
|
44
44
|
return this.fields.slice(0, this.emittedLength);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
getEmittedFieldsWithoutTag() {
|
|
48
|
+
return this.fields.slice(1, this.emittedLength);
|
|
49
|
+
}
|
|
50
|
+
|
|
47
51
|
toBlobFields(): Fr[] {
|
|
48
52
|
return [new Fr(this.emittedLength)].concat(this.getEmittedFields());
|
|
49
53
|
}
|
package/src/logs/public_log.ts
CHANGED
|
@@ -50,6 +50,10 @@ export class PublicLog {
|
|
|
50
50
|
return this.fields.slice(0, this.emittedLength);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
getEmittedFieldsWithoutTag() {
|
|
54
|
+
return this.fields.slice(1, this.emittedLength);
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
toBlobFields(): Fr[] {
|
|
54
58
|
return [new Fr(this.emittedLength), this.contractAddress.toField()].concat(this.getEmittedFields());
|
|
55
59
|
}
|
|
@@ -6,6 +6,7 @@ import { TxHash } from '../tx/tx_hash.js';
|
|
|
6
6
|
import { PrivateLog } from './private_log.js';
|
|
7
7
|
import { PublicLog } from './public_log.js';
|
|
8
8
|
|
|
9
|
+
// TODO(#14460): Split to private and public versions instead of having this weird mix.
|
|
9
10
|
export class TxScopedL2Log {
|
|
10
11
|
constructor(
|
|
11
12
|
/*
|
package/src/messaging/index.ts
CHANGED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { SHA256Trunc } from '@aztec/foundation/crypto';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { MerkleTreeCalculator, SiblingPath, UnbalancedMerkleTreeCalculator } from '@aztec/foundation/trees';
|
|
4
|
+
|
|
5
|
+
export interface MessageRetrieval {
|
|
6
|
+
getL2ToL1Messages(l2BlockNumber: number): Promise<Fr[][] | undefined>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type L2ToL1MembershipWitness = {
|
|
10
|
+
l2MessageIndex: bigint;
|
|
11
|
+
siblingPath: SiblingPath<number>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export async function computeL2ToL1MembershipWitness(
|
|
15
|
+
messageRetriever: MessageRetrieval,
|
|
16
|
+
l2BlockNumber: number,
|
|
17
|
+
message: Fr,
|
|
18
|
+
): Promise<L2ToL1MembershipWitness | undefined> {
|
|
19
|
+
const messagesPerTx = await messageRetriever.getL2ToL1Messages(l2BlockNumber);
|
|
20
|
+
if (!messagesPerTx) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Find index of message in subtree and index of tx in a block
|
|
25
|
+
let messageIndexInTx = -1,
|
|
26
|
+
txIndex = -1;
|
|
27
|
+
{
|
|
28
|
+
txIndex = messagesPerTx.findIndex(messages => {
|
|
29
|
+
const idx = messages.findIndex(msg => msg.equals(message));
|
|
30
|
+
messageIndexInTx = Math.max(messageIndexInTx, idx);
|
|
31
|
+
return idx !== -1;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (txIndex === -1) {
|
|
36
|
+
throw new Error('The L2ToL1Message you are trying to prove inclusion of does not exist');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const hasher = new SHA256Trunc();
|
|
40
|
+
|
|
41
|
+
// Get the message path in subtree and message subtree height
|
|
42
|
+
let messagePathInSubtree: SiblingPath<number>;
|
|
43
|
+
let messageSubtreeHeight: number;
|
|
44
|
+
{
|
|
45
|
+
const txMessages = messagesPerTx[txIndex];
|
|
46
|
+
messageSubtreeHeight = txMessages.length <= 1 ? 1 : Math.ceil(Math.log2(txMessages.length));
|
|
47
|
+
const calculator: MerkleTreeCalculator = await MerkleTreeCalculator.create(
|
|
48
|
+
messageSubtreeHeight,
|
|
49
|
+
Buffer.alloc(32, 0), // Zero leaf
|
|
50
|
+
(lhs: Buffer, rhs: Buffer) => Promise.resolve(hasher.hash(lhs, rhs)),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const tree = await calculator.computeTree(txMessages.map(msg => msg.toBuffer()));
|
|
54
|
+
const tempPath = tree.getSiblingPath(messageIndexInTx);
|
|
55
|
+
messagePathInSubtree = new SiblingPath(tempPath.length, tempPath);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// If the number of txs is 1 we are dealing with a special case where the tx subtree itself is the whole block's
|
|
59
|
+
// l2 to l1 message tree.
|
|
60
|
+
const numTransactions = messagesPerTx.length;
|
|
61
|
+
if (numTransactions === 1) {
|
|
62
|
+
return {
|
|
63
|
+
l2MessageIndex: BigInt(messageIndexInTx),
|
|
64
|
+
siblingPath: messagePathInSubtree,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Calculate roots for all tx subtrees
|
|
69
|
+
const txSubtreeRoots = await Promise.all(
|
|
70
|
+
messagesPerTx.map(async (messages, _) => {
|
|
71
|
+
// For a tx with no messages, we have to set an out hash of 0 to match what the circuit does.
|
|
72
|
+
if (messages.length === 0) {
|
|
73
|
+
return Fr.ZERO;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const txTreeHeight = messages.length <= 1 ? 1 : Math.ceil(Math.log2(messages.length));
|
|
77
|
+
const calculator: MerkleTreeCalculator = await MerkleTreeCalculator.create(
|
|
78
|
+
txTreeHeight,
|
|
79
|
+
Buffer.alloc(32, 0), // Zero leaf
|
|
80
|
+
(lhs: Buffer, rhs: Buffer) => Promise.resolve(hasher.hash(lhs, rhs)),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const root = await calculator.computeTreeRoot(messages.map(msg => msg.toBuffer()));
|
|
84
|
+
return Fr.fromBuffer(root);
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// Construct the top tree and compute the combined path
|
|
89
|
+
let combinedPath: Buffer[];
|
|
90
|
+
{
|
|
91
|
+
const topTreeHeight = Math.ceil(Math.log2(txSubtreeRoots.length));
|
|
92
|
+
// The root of this tree is the out_hash calculated in Noir => we truncate to match Noir's SHA
|
|
93
|
+
const topTree = UnbalancedMerkleTreeCalculator.create(topTreeHeight, (lhs: Buffer, rhs: Buffer) =>
|
|
94
|
+
Promise.resolve(hasher.hash(lhs, rhs)),
|
|
95
|
+
);
|
|
96
|
+
await topTree.appendLeaves(txSubtreeRoots.map(f => f.toBuffer()));
|
|
97
|
+
|
|
98
|
+
const txPathInTopTree = await topTree.getSiblingPath(txSubtreeRoots[txIndex].toBigInt());
|
|
99
|
+
// Append subtree path to top tree path
|
|
100
|
+
combinedPath = messagePathInSubtree.toBufferArray().concat(txPathInTopTree.toBufferArray());
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Append binary index of subtree path to binary index of top tree path
|
|
104
|
+
const combinedIndex = parseInt(
|
|
105
|
+
txIndex.toString(2).concat(messageIndexInTx.toString(2).padStart(messageSubtreeHeight, '0')),
|
|
106
|
+
2,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
l2MessageIndex: BigInt(combinedIndex),
|
|
111
|
+
siblingPath: new SiblingPath(combinedPath.length, combinedPath),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
@@ -107,6 +107,8 @@ export class ConsensusPayload implements Signable {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
toString() {
|
|
110
|
-
return `header: ${this.header.toString()}, archive: ${this.archive.toString()}, stateReference: ${this.stateReference.l1ToL2MessageTree.root.toString()}, txHashes: ${this.txHashes.join(
|
|
110
|
+
return `header: ${this.header.toString()}, archive: ${this.archive.toString()}, stateReference: ${this.stateReference.l1ToL2MessageTree.root.toString()}, txHashes: ${this.txHashes.join(
|
|
111
|
+
', ',
|
|
112
|
+
)}`;
|
|
111
113
|
}
|
|
112
114
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
4
|
|
|
4
5
|
import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
|
|
5
6
|
import { RecursiveProof, makeEmptyRecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
7
|
+
import { VkData } from '../vks/vk_data.js';
|
|
7
8
|
|
|
8
9
|
export class AvmProofData {
|
|
9
10
|
constructor(
|
|
10
11
|
public publicInputs: AvmCircuitPublicInputs,
|
|
11
|
-
public proof: RecursiveProof<typeof
|
|
12
|
-
public vkData:
|
|
12
|
+
public proof: RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>,
|
|
13
|
+
public vkData: VkData,
|
|
13
14
|
) {}
|
|
14
15
|
|
|
15
16
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
@@ -17,7 +18,7 @@ export class AvmProofData {
|
|
|
17
18
|
return new AvmProofData(
|
|
18
19
|
reader.readObject(AvmCircuitPublicInputs),
|
|
19
20
|
RecursiveProof.fromBuffer(reader),
|
|
20
|
-
reader.readObject(
|
|
21
|
+
reader.readObject(VkData),
|
|
21
22
|
);
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -28,8 +29,14 @@ export class AvmProofData {
|
|
|
28
29
|
static empty() {
|
|
29
30
|
return new AvmProofData(
|
|
30
31
|
AvmCircuitPublicInputs.empty(),
|
|
31
|
-
makeEmptyRecursiveProof(
|
|
32
|
-
|
|
32
|
+
makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
33
|
+
VkData.empty(),
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
37
|
+
|
|
38
|
+
// TODO(#14234)[Unconditional PIs validation]: remove this function.
|
|
39
|
+
export function enhanceProofWithPiValidationFlag(proof: Fr[], skipPublicInputsValidation: boolean): Fr[] {
|
|
40
|
+
const skipPublicInputsField = skipPublicInputsValidation ? new Fr(1) : new Fr(0);
|
|
41
|
+
return [skipPublicInputsField].concat(proof).slice(0, AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED);
|
|
42
|
+
}
|
|
@@ -39,7 +39,7 @@ export class PrivateBaseRollupHints {
|
|
|
39
39
|
/**
|
|
40
40
|
* Preimages to the kernel's contractClassLogsHashes.
|
|
41
41
|
*/
|
|
42
|
-
public
|
|
42
|
+
public contractClassLogsFields: Tuple<ContractClassLogFields, typeof MAX_CONTRACT_CLASS_LOGS_PER_TX>,
|
|
43
43
|
/**
|
|
44
44
|
* Data which is not modified by the base rollup circuit.
|
|
45
45
|
*/
|
|
@@ -57,7 +57,7 @@ export class PrivateBaseRollupHints {
|
|
|
57
57
|
fields.stateDiffHints,
|
|
58
58
|
fields.feePayerFeeJuiceBalanceReadHint,
|
|
59
59
|
fields.archiveRootMembershipWitness,
|
|
60
|
-
fields.
|
|
60
|
+
fields.contractClassLogsFields,
|
|
61
61
|
fields.constants,
|
|
62
62
|
] as const;
|
|
63
63
|
}
|
|
@@ -121,7 +121,7 @@ export class PublicBaseRollupHints {
|
|
|
121
121
|
/**
|
|
122
122
|
* Preimages to the kernel's contractClassLogsHashes.
|
|
123
123
|
*/
|
|
124
|
-
public
|
|
124
|
+
public contractClassLogsFields: Tuple<ContractClassLogFields, typeof MAX_CONTRACT_CLASS_LOGS_PER_TX>,
|
|
125
125
|
/**
|
|
126
126
|
* Data which is not modified by the base rollup circuit.
|
|
127
127
|
*/
|
|
@@ -136,7 +136,7 @@ export class PublicBaseRollupHints {
|
|
|
136
136
|
return [
|
|
137
137
|
fields.startSpongeBlob,
|
|
138
138
|
fields.archiveRootMembershipWitness,
|
|
139
|
-
fields.
|
|
139
|
+
fields.contractClassLogsFields,
|
|
140
140
|
fields.constants,
|
|
141
141
|
] as const;
|
|
142
142
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
1
|
+
import { NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
-
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
3
|
|
|
5
4
|
import { RecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
5
|
+
import { VkData } from '../vks/index.js';
|
|
7
6
|
import { BlockRootOrBlockMergePublicInputs } from './block_root_or_block_merge_public_inputs.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -20,13 +19,9 @@ export class PreviousRollupBlockData {
|
|
|
20
19
|
*/
|
|
21
20
|
public proof: RecursiveProof<typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>,
|
|
22
21
|
/**
|
|
23
|
-
* The verification key
|
|
22
|
+
* The verification key and the witness of the vk in the vk tree.
|
|
24
23
|
*/
|
|
25
|
-
public
|
|
26
|
-
/**
|
|
27
|
-
* Sibling path of the rollup circuit's vk in a big tree of rollup circuit vks.
|
|
28
|
-
*/
|
|
29
|
-
public vkWitness: MembershipWitness<typeof VK_TREE_HEIGHT>,
|
|
24
|
+
public vkData: VkData,
|
|
30
25
|
) {}
|
|
31
26
|
|
|
32
27
|
/**
|
|
@@ -34,7 +29,7 @@ export class PreviousRollupBlockData {
|
|
|
34
29
|
* @returns The buffer of the serialized previous rollup data.
|
|
35
30
|
*/
|
|
36
31
|
public toBuffer(): Buffer {
|
|
37
|
-
return serializeToBuffer(this.blockRootOrBlockMergePublicInputs, this.proof, this.
|
|
32
|
+
return serializeToBuffer(this.blockRootOrBlockMergePublicInputs, this.proof, this.vkData);
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
/**
|
|
@@ -47,8 +42,7 @@ export class PreviousRollupBlockData {
|
|
|
47
42
|
return new PreviousRollupBlockData(
|
|
48
43
|
reader.readObject(BlockRootOrBlockMergePublicInputs),
|
|
49
44
|
RecursiveProof.fromBuffer(reader, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
50
|
-
reader.readObject(
|
|
51
|
-
MembershipWitness.fromBuffer(reader, VK_TREE_HEIGHT),
|
|
45
|
+
reader.readObject(VkData),
|
|
52
46
|
);
|
|
53
47
|
}
|
|
54
48
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
1
|
+
import { NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
-
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
3
|
|
|
5
4
|
import { RecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
5
|
+
import { VkData } from '../vks/index.js';
|
|
7
6
|
import { BaseOrMergeRollupPublicInputs } from './base_or_merge_rollup_public_inputs.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -20,13 +19,9 @@ export class PreviousRollupData {
|
|
|
20
19
|
*/
|
|
21
20
|
public proof: RecursiveProof<typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>,
|
|
22
21
|
/**
|
|
23
|
-
* The verification key of the
|
|
22
|
+
* The verification key and the witness of the vk in the vk tree.
|
|
24
23
|
*/
|
|
25
|
-
public
|
|
26
|
-
/**
|
|
27
|
-
* Sibling path of the rollup circuit's vk in a big tree of rollup circuit vks.
|
|
28
|
-
*/
|
|
29
|
-
public vkWitness: MembershipWitness<typeof VK_TREE_HEIGHT>,
|
|
24
|
+
public vkData: VkData,
|
|
30
25
|
) {}
|
|
31
26
|
|
|
32
27
|
/**
|
|
@@ -34,7 +29,7 @@ export class PreviousRollupData {
|
|
|
34
29
|
* @returns The buffer of the serialized previous rollup data.
|
|
35
30
|
*/
|
|
36
31
|
public toBuffer(): Buffer {
|
|
37
|
-
return serializeToBuffer(this.baseOrMergeRollupPublicInputs, this.proof, this.
|
|
32
|
+
return serializeToBuffer(this.baseOrMergeRollupPublicInputs, this.proof, this.vkData);
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
/**
|
|
@@ -47,8 +42,7 @@ export class PreviousRollupData {
|
|
|
47
42
|
return new PreviousRollupData(
|
|
48
43
|
reader.readObject(BaseOrMergeRollupPublicInputs),
|
|
49
44
|
RecursiveProof.fromBuffer(reader, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
50
|
-
reader.readObject(
|
|
51
|
-
MembershipWitness.fromBuffer(reader, VK_TREE_HEIGHT),
|
|
45
|
+
reader.readObject(VkData),
|
|
52
46
|
);
|
|
53
47
|
}
|
|
54
48
|
}
|
|
@@ -3,20 +3,20 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
3
3
|
|
|
4
4
|
import { PrivateToRollupKernelCircuitPublicInputs } from '../kernel/private_to_rollup_kernel_circuit_public_inputs.js';
|
|
5
5
|
import { RecursiveProof, makeEmptyRecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
6
|
+
import { VkData } from '../vks/index.js';
|
|
7
7
|
|
|
8
8
|
export class PrivateTubeData {
|
|
9
9
|
constructor(
|
|
10
10
|
public publicInputs: PrivateToRollupKernelCircuitPublicInputs,
|
|
11
11
|
public proof: RecursiveProof<typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>,
|
|
12
|
-
public vkData:
|
|
12
|
+
public vkData: VkData,
|
|
13
13
|
) {}
|
|
14
14
|
|
|
15
15
|
static empty() {
|
|
16
16
|
return new PrivateTubeData(
|
|
17
17
|
PrivateToRollupKernelCircuitPublicInputs.empty(),
|
|
18
18
|
makeEmptyRecursiveProof(NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
19
|
-
|
|
19
|
+
VkData.empty(),
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ export class PrivateTubeData {
|
|
|
25
25
|
return new PrivateTubeData(
|
|
26
26
|
reader.readObject(PrivateToRollupKernelCircuitPublicInputs),
|
|
27
27
|
RecursiveProof.fromBuffer(reader, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
28
|
-
reader.readObject(
|
|
28
|
+
reader.readObject(VkData),
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -3,20 +3,20 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
3
3
|
|
|
4
4
|
import { PrivateToPublicKernelCircuitPublicInputs } from '../kernel/private_to_public_kernel_circuit_public_inputs.js';
|
|
5
5
|
import { RecursiveProof, makeEmptyRecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
6
|
+
import { VkData } from '../vks/index.js';
|
|
7
7
|
|
|
8
8
|
export class PublicTubeData {
|
|
9
9
|
constructor(
|
|
10
10
|
public publicInputs: PrivateToPublicKernelCircuitPublicInputs,
|
|
11
11
|
public proof: RecursiveProof<typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>,
|
|
12
|
-
public vkData:
|
|
12
|
+
public vkData: VkData,
|
|
13
13
|
) {}
|
|
14
14
|
|
|
15
15
|
static empty() {
|
|
16
16
|
return new PublicTubeData(
|
|
17
17
|
PrivateToPublicKernelCircuitPublicInputs.empty(),
|
|
18
18
|
makeEmptyRecursiveProof(NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
19
|
-
|
|
19
|
+
VkData.empty(),
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ export class PublicTubeData {
|
|
|
25
25
|
return new PublicTubeData(
|
|
26
26
|
reader.readObject(PrivateToPublicKernelCircuitPublicInputs),
|
|
27
27
|
RecursiveProof.fromBuffer(reader, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
28
|
-
reader.readObject(
|
|
28
|
+
reader.readObject(VkData),
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -7,7 +7,6 @@ import { BufferReader, type Tuple, serializeToBuffer, serializeToFields } from '
|
|
|
7
7
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
8
8
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
9
9
|
|
|
10
|
-
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
11
10
|
import { FeeRecipient } from './block_root_or_block_merge_public_inputs.js';
|
|
12
11
|
import { PreviousRollupBlockData } from './previous_rollup_block_data.js';
|
|
13
12
|
|
|
@@ -100,13 +99,10 @@ export class RootRollupInputs {
|
|
|
100
99
|
*/
|
|
101
100
|
export class RootRollupPublicInputs {
|
|
102
101
|
constructor(
|
|
103
|
-
/**
|
|
104
|
-
public
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
public endTimestamp: Fr,
|
|
108
|
-
public endBlockNumber: Fr,
|
|
109
|
-
public outHash: Fr,
|
|
102
|
+
/** Root of the archive tree before this rollup is processed */
|
|
103
|
+
public previousArchiveRoot: Fr,
|
|
104
|
+
/** Root of the archive tree after this rollup is processed */
|
|
105
|
+
public endArchiveRoot: Fr,
|
|
110
106
|
public proposedBlockHeaderHashes: Tuple<Fr, typeof AZTEC_MAX_EPOCH_DURATION>,
|
|
111
107
|
public fees: Tuple<FeeRecipient, typeof AZTEC_MAX_EPOCH_DURATION>,
|
|
112
108
|
public chainId: Fr,
|
|
@@ -119,11 +115,8 @@ export class RootRollupPublicInputs {
|
|
|
119
115
|
|
|
120
116
|
static getFields(fields: FieldsOf<RootRollupPublicInputs>) {
|
|
121
117
|
return [
|
|
122
|
-
fields.
|
|
123
|
-
fields.
|
|
124
|
-
fields.endTimestamp,
|
|
125
|
-
fields.endBlockNumber,
|
|
126
|
-
fields.outHash,
|
|
118
|
+
fields.previousArchiveRoot,
|
|
119
|
+
fields.endArchiveRoot,
|
|
127
120
|
fields.proposedBlockHeaderHashes,
|
|
128
121
|
fields.fees,
|
|
129
122
|
fields.chainId,
|
|
@@ -155,9 +148,6 @@ export class RootRollupPublicInputs {
|
|
|
155
148
|
public static fromBuffer(buffer: Buffer | BufferReader): RootRollupPublicInputs {
|
|
156
149
|
const reader = BufferReader.asReader(buffer);
|
|
157
150
|
return new RootRollupPublicInputs(
|
|
158
|
-
reader.readObject(AppendOnlyTreeSnapshot),
|
|
159
|
-
reader.readObject(AppendOnlyTreeSnapshot),
|
|
160
|
-
Fr.fromBuffer(reader),
|
|
161
151
|
Fr.fromBuffer(reader),
|
|
162
152
|
Fr.fromBuffer(reader),
|
|
163
153
|
reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr),
|
|
@@ -192,9 +182,6 @@ export class RootRollupPublicInputs {
|
|
|
192
182
|
/** Creates a random instance. */
|
|
193
183
|
static random() {
|
|
194
184
|
return new RootRollupPublicInputs(
|
|
195
|
-
AppendOnlyTreeSnapshot.random(),
|
|
196
|
-
AppendOnlyTreeSnapshot.random(),
|
|
197
|
-
Fr.random(),
|
|
198
185
|
Fr.random(),
|
|
199
186
|
Fr.random(),
|
|
200
187
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, Fr.random),
|