@aztec/stdlib 0.87.3-nightly.20250529 → 0.87.4
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 +0 -3
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +0 -38
- package/dest/avm/avm.d.ts +12 -696
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +8 -16
- package/dest/avm/avm_accumulated_data.d.ts +0 -77
- package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.js +0 -67
- package/dest/avm/avm_circuit_public_inputs.d.ts +3 -73
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +9 -19
- package/dest/avm/avm_proving_request.d.ts +0 -366
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- 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 +0 -1
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +0 -1
- package/dest/block/l2_block.d.ts +2 -3
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +5 -10
- package/dest/block/l2_block_source.d.ts +4 -9
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +0 -1
- package/dest/block/published_l2_block.d.ts +69 -99
- package/dest/block/published_l2_block.d.ts.map +1 -1
- package/dest/block/published_l2_block.js +12 -38
- package/dest/block/test/l2_tips_store_test_suite.js +1 -1
- package/dest/interfaces/archiver.js +2 -2
- package/dest/interfaces/aztec-node.js +2 -2
- package/dest/interfaces/p2p.d.ts +2 -5
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +2 -1
- package/dest/interfaces/proving-job.d.ts +4 -370
- 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 +2 -3
- 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 +6 -2
- package/dest/kernel/hints/key_validation_hint.d.ts.map +1 -1
- package/dest/kernel/hints/key_validation_hint.js +7 -5
- 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 +4 -8
- 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 +0 -1
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +0 -1
- package/dest/kernel/private_kernel_data.d.ts +25 -6
- package/dest/kernel/private_kernel_data.d.ts.map +1 -1
- package/dest/kernel/private_kernel_data.js +19 -8
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts +4 -7
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.js +6 -10
- 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 +1 -10
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +3 -8
- package/dest/kernel/public_call_request.d.ts +0 -54
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +0 -58
- package/dest/logs/contract_class_log.d.ts +4 -0
- package/dest/logs/contract_class_log.d.ts.map +1 -1
- package/dest/logs/contract_class_log.js +33 -0
- package/dest/logs/log_with_tx_data.d.ts +3 -3
- package/dest/logs/log_with_tx_data.d.ts.map +1 -1
- package/dest/logs/log_with_tx_data.js +13 -9
- package/dest/logs/private_log.d.ts +0 -1
- package/dest/logs/private_log.d.ts.map +1 -1
- package/dest/logs/private_log.js +0 -3
- package/dest/logs/public_log.d.ts +0 -1
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +0 -3
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +0 -1
- package/dest/rollup/avm_proof_data.d.ts +5 -7
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/avm_proof_data.js +4 -12
- 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 +15 -6
- package/dest/rollup/previous_rollup_block_data.d.ts.map +1 -1
- package/dest/rollup/previous_rollup_block_data.js +13 -8
- package/dest/rollup/previous_rollup_data.d.ts +15 -6
- package/dest/rollup/previous_rollup_data.d.ts.map +1 -1
- package/dest/rollup/previous_rollup_data.js +13 -8
- 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 +10 -9
- package/dest/rollup/root_rollup.d.ts.map +1 -1
- package/dest/rollup/root_rollup.js +20 -9
- package/dest/tests/factories.d.ts +1 -2
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +19 -25
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +3 -4
- package/dest/tx/processed_tx.d.ts.map +1 -1
- package/dest/tx/processed_tx.js +5 -2
- package/dest/tx/tx.d.ts +25 -10
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +50 -25
- 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/validators/types.d.ts +0 -4
- 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_data.d.ts → vk_witness_data.d.ts} +8 -8
- package/dest/vks/vk_witness_data.d.ts.map +1 -0
- package/dest/vks/{vk_data.js → vk_witness_data.js} +10 -10
- package/package.json +7 -7
- package/src/abi/abi.ts +0 -37
- package/src/avm/avm.ts +0 -14
- package/src/avm/avm_accumulated_data.ts +0 -93
- package/src/avm/avm_circuit_public_inputs.ts +2 -22
- package/src/block/body.ts +2 -7
- package/src/block/index.ts +0 -1
- package/src/block/l2_block.ts +3 -8
- package/src/block/l2_block_source.ts +3 -9
- package/src/block/published_l2_block.ts +24 -38
- 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 +2 -2
- package/src/interfaces/p2p.ts +3 -8
- package/src/interfaces/proving-job.ts +3 -3
- package/src/interfaces/server_circuit_prover.ts +2 -3
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +3 -3
- package/src/kernel/hints/key_validation_hint.ts +6 -4
- package/src/kernel/hints/private_kernel_reset_hints.ts +43 -34
- package/src/kernel/hints/read_request_hints.ts +15 -27
- package/src/kernel/index.ts +0 -1
- package/src/kernel/private_kernel_data.ts +29 -7
- package/src/kernel/private_kernel_reset_circuit_private_inputs.ts +13 -16
- package/src/kernel/private_kernel_reset_dimensions.ts +27 -27
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +2 -10
- package/src/kernel/public_call_request.ts +0 -66
- package/src/logs/contract_class_log.ts +36 -0
- package/src/logs/log_with_tx_data.ts +11 -7
- package/src/logs/private_log.ts +0 -4
- package/src/logs/public_log.ts +0 -4
- package/src/logs/tx_scoped_l2_log.ts +0 -1
- package/src/rollup/avm_proof_data.ts +7 -14
- package/src/rollup/base_rollup_hints.ts +4 -4
- package/src/rollup/previous_rollup_block_data.ts +12 -6
- package/src/rollup/previous_rollup_data.ts +12 -6
- package/src/rollup/private_tube_data.ts +4 -4
- package/src/rollup/public_tube_data.ts +4 -4
- package/src/rollup/root_rollup.ts +19 -6
- package/src/tests/factories.ts +32 -36
- package/src/tests/mocks.ts +3 -6
- package/src/tx/processed_tx.ts +5 -4
- package/src/tx/tx.ts +54 -28
- package/src/tx/tx_effect.ts +5 -23
- package/src/validators/types.ts +0 -2
- package/src/vks/index.ts +1 -1
- package/src/vks/{vk_data.ts → vk_witness_data.ts} +6 -6
- package/dest/block/proposal/committee_attestation.d.ts +0 -34
- package/dest/block/proposal/committee_attestation.d.ts.map +0 -1
- package/dest/block/proposal/committee_attestation.js +0 -59
- package/dest/block/proposal/index.d.ts +0 -2
- package/dest/block/proposal/index.d.ts.map +0 -1
- package/dest/block/proposal/index.js +0 -1
- package/dest/kernel/padded_side_effects.d.ts +0 -26
- package/dest/kernel/padded_side_effects.d.ts.map +0 -1
- package/dest/kernel/padded_side_effects.js +0 -51
- package/dest/vks/vk_data.d.ts.map +0 -1
- package/src/block/proposal/committee_attestation.ts +0 -70
- package/src/block/proposal/index.ts +0 -1
- package/src/kernel/padded_side_effects.ts +0 -73
package/src/tx/processed_tx.ts
CHANGED
|
@@ -99,7 +99,7 @@ export async function makeProcessedTxFromPrivateOnlyTx(
|
|
|
99
99
|
[feePaymentPublicDataWrite],
|
|
100
100
|
data.end.privateLogs.filter(l => !l.isEmpty()),
|
|
101
101
|
[],
|
|
102
|
-
tx.
|
|
102
|
+
await tx.filterContractClassLogs(tx.data.getNonEmptyContractClassLogsHashes(), true),
|
|
103
103
|
);
|
|
104
104
|
|
|
105
105
|
const gasUsed = {
|
|
@@ -147,9 +147,10 @@ export async function makeProcessedTxFromTxWithPublicCalls(
|
|
|
147
147
|
...(revertCode.isOK() ? tx.data.forPublic!.revertibleAccumulatedData.privateLogs : []),
|
|
148
148
|
].filter(l => !l.isEmpty());
|
|
149
149
|
|
|
150
|
-
const contractClassLogs =
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
const contractClassLogs = [
|
|
151
|
+
...(await tx.getSplitContractClassLogs(false, true)),
|
|
152
|
+
...(revertCode.isOK() ? await tx.getSplitContractClassLogs(true, true) : []),
|
|
153
|
+
].filter(l => !l.isEmpty());
|
|
153
154
|
|
|
154
155
|
const txEffect = new TxEffect(
|
|
155
156
|
revertCode,
|
package/src/tx/tx.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { GasSettings } from '../gas/gas_settings.js';
|
|
|
11
11
|
import type { GetPublicLogsResponse } from '../interfaces/get_logs_response.js';
|
|
12
12
|
import type { L2LogsSource } from '../interfaces/l2_logs_source.js';
|
|
13
13
|
import type { PublicCallRequest } from '../kernel/index.js';
|
|
14
|
+
import type { ScopedLogHash } from '../kernel/log_hash.js';
|
|
14
15
|
import { PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_tail_circuit_public_inputs.js';
|
|
15
16
|
import { ContractClassLog, ContractClassLogFields } from '../logs/contract_class_log.js';
|
|
16
17
|
import { Gossipable } from '../p2p/gossipable.js';
|
|
@@ -41,11 +42,9 @@ export class Tx extends Gossipable {
|
|
|
41
42
|
*/
|
|
42
43
|
public readonly clientIvcProof: ClientIvcProof,
|
|
43
44
|
/**
|
|
44
|
-
* Contract class
|
|
45
|
-
* Their order should match the order of the log hashes returned from `this.data.getNonEmptyContractClassLogsHashes`.
|
|
46
|
-
* It's checked in data_validator.ts
|
|
45
|
+
* Contract class logs generated by the tx.
|
|
47
46
|
*/
|
|
48
|
-
public
|
|
47
|
+
public contractClassLogs: ContractClassLogFields[],
|
|
49
48
|
/**
|
|
50
49
|
* An array of calldata for the enqueued public function calls and the teardown function call.
|
|
51
50
|
*/
|
|
@@ -121,7 +120,7 @@ export class Tx extends Gossipable {
|
|
|
121
120
|
return serializeToBuffer([
|
|
122
121
|
this.data,
|
|
123
122
|
this.clientIvcProof,
|
|
124
|
-
serializeArrayOfBufferableToVector(this.
|
|
123
|
+
serializeArrayOfBufferableToVector(this.contractClassLogs, 1),
|
|
125
124
|
serializeArrayOfBufferableToVector(this.publicFunctionCalldata, 1),
|
|
126
125
|
]);
|
|
127
126
|
}
|
|
@@ -131,14 +130,14 @@ export class Tx extends Gossipable {
|
|
|
131
130
|
.object({
|
|
132
131
|
data: PrivateKernelTailCircuitPublicInputs.schema,
|
|
133
132
|
clientIvcProof: ClientIvcProof.schema,
|
|
134
|
-
|
|
133
|
+
contractClassLogs: z.array(ContractClassLogFields.schema),
|
|
135
134
|
publicFunctionCalldata: z.array(HashedValues.schema),
|
|
136
135
|
})
|
|
137
136
|
.transform(Tx.from);
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
static from(fields: FieldsOf<Tx>) {
|
|
141
|
-
return new Tx(fields.data, fields.clientIvcProof, fields.
|
|
140
|
+
return new Tx(fields.data, fields.clientIvcProof, fields.contractClassLogs, fields.publicFunctionCalldata);
|
|
142
141
|
}
|
|
143
142
|
|
|
144
143
|
/**
|
|
@@ -150,32 +149,43 @@ export class Tx extends Gossipable {
|
|
|
150
149
|
return logsSource.getPublicLogs({ txHash: await this.getTxHash() });
|
|
151
150
|
}
|
|
152
151
|
|
|
153
|
-
getContractClassLogs(): ContractClassLog[] {
|
|
154
|
-
const logHashes = this.data.getNonEmptyContractClassLogsHashes();
|
|
155
|
-
return logHashes.map((logHash, i) =>
|
|
156
|
-
ContractClassLog.from({
|
|
157
|
-
contractAddress: logHash.contractAddress,
|
|
158
|
-
fields: this.contractClassLogFields[i],
|
|
159
|
-
emittedLength: logHash.logHash.length,
|
|
160
|
-
}),
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
152
|
/**
|
|
165
153
|
* Gets either revertible or non revertible contract class logs emitted by this tx.
|
|
166
154
|
* @param revertible - true for revertible only logs, false for non reverible only logs.
|
|
167
155
|
* @returns The requested logs.
|
|
168
156
|
*/
|
|
169
|
-
getSplitContractClassLogs(revertible: boolean): ContractClassLog[] {
|
|
157
|
+
async getSplitContractClassLogs(revertible: boolean, silo: boolean = false): Promise<ContractClassLog[]> {
|
|
158
|
+
// Should only be called on txs with public calls
|
|
170
159
|
if (!this.data.forPublic) {
|
|
171
|
-
|
|
160
|
+
return [];
|
|
172
161
|
}
|
|
162
|
+
const contractClassLogsHashes = revertible
|
|
163
|
+
? this.data.forPublic.revertibleAccumulatedData.contractClassLogsHashes.filter(h => !h.isEmpty())
|
|
164
|
+
: this.data.forPublic.nonRevertibleAccumulatedData.contractClassLogsHashes.filter(h => !h.isEmpty());
|
|
165
|
+
return await this.filterContractClassLogs(contractClassLogsHashes, silo);
|
|
166
|
+
}
|
|
173
167
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Filters contract class logs emitted by this tx.
|
|
170
|
+
* @param logHashes - logs to keep represented by their hashes.
|
|
171
|
+
* @param silo - whether to silo the logs before returning them.
|
|
172
|
+
* @returns The requested logs.
|
|
173
|
+
*/
|
|
174
|
+
async filterContractClassLogs(logHashes: ScopedLogHash[], silo: boolean = false): Promise<ContractClassLog[]> {
|
|
175
|
+
const contractClassLogs = [];
|
|
176
|
+
for (const fields of this.contractClassLogs) {
|
|
177
|
+
const hashedLog = await fields.hash();
|
|
178
|
+
const logHash = logHashes.find(hash => hash.value.equals(hashedLog));
|
|
179
|
+
if (logHash) {
|
|
180
|
+
const log = ContractClassLog.from({
|
|
181
|
+
contractAddress: logHash.contractAddress,
|
|
182
|
+
fields,
|
|
183
|
+
emittedLength: logHash.logHash.length,
|
|
184
|
+
});
|
|
185
|
+
contractClassLogs.push(silo ? await log.silo() : log);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return contractClassLogs;
|
|
179
189
|
}
|
|
180
190
|
|
|
181
191
|
/**
|
|
@@ -236,7 +246,7 @@ export class Tx extends Gossipable {
|
|
|
236
246
|
return (
|
|
237
247
|
this.data.getSize() +
|
|
238
248
|
this.clientIvcProof.clientIvcProofBuffer.length +
|
|
239
|
-
arraySerializedSizeOfNonEmpty(this.
|
|
249
|
+
arraySerializedSizeOfNonEmpty(this.contractClassLogs) +
|
|
240
250
|
this.publicFunctionCalldata.reduce((accum, cd) => accum + cd.getSize(), 0)
|
|
241
251
|
);
|
|
242
252
|
}
|
|
@@ -280,9 +290,9 @@ export class Tx extends Gossipable {
|
|
|
280
290
|
static clone(tx: Tx): Tx {
|
|
281
291
|
const publicInputs = PrivateKernelTailCircuitPublicInputs.fromBuffer(tx.data.toBuffer());
|
|
282
292
|
const clientIvcProof = ClientIvcProof.fromBuffer(tx.clientIvcProof.toBuffer());
|
|
283
|
-
const
|
|
293
|
+
const contractClassLogs = tx.contractClassLogs.map(p => p.clone());
|
|
284
294
|
const publicFunctionCalldata = tx.publicFunctionCalldata.map(cd => HashedValues.fromBuffer(cd.toBuffer()));
|
|
285
|
-
const clonedTx = new Tx(publicInputs, clientIvcProof,
|
|
295
|
+
const clonedTx = new Tx(publicInputs, clientIvcProof, contractClassLogs, publicFunctionCalldata);
|
|
286
296
|
if (tx.txHash) {
|
|
287
297
|
clonedTx.setTxHash(TxHash.fromBuffer(tx.txHash.toBuffer()));
|
|
288
298
|
}
|
|
@@ -304,6 +314,22 @@ export class Tx extends Gossipable {
|
|
|
304
314
|
);
|
|
305
315
|
}
|
|
306
316
|
|
|
317
|
+
/**
|
|
318
|
+
* Filters out logs from functions that are not present in the provided kernel output.
|
|
319
|
+
*
|
|
320
|
+
* The purpose of this is to remove logs that got dropped due to a revert,
|
|
321
|
+
* in which case, we only have the kernel's hashes to go on, as opposed to
|
|
322
|
+
* this grouping by function maintained in this class.
|
|
323
|
+
*
|
|
324
|
+
* The logic therefore is to drop all FunctionLogs if any constituent hash
|
|
325
|
+
* does not appear in the provided hashes: it is impossible for part of a
|
|
326
|
+
* function to revert.
|
|
327
|
+
*/
|
|
328
|
+
// TODO: don't modify the tx object directly. The preimages should match the log hashes. When did the log hashes change?
|
|
329
|
+
public async filterRevertedLogs() {
|
|
330
|
+
this.contractClassLogs = (await this.getSplitContractClassLogs(false)).map(log => log.fields);
|
|
331
|
+
}
|
|
332
|
+
|
|
307
333
|
#combinePublicCallRequestWithCallData(request: PublicCallRequest) {
|
|
308
334
|
const calldataMap = this.getCalldataMap();
|
|
309
335
|
// Assume empty calldata if nothing is given for the hash.
|
package/src/tx/tx_effect.ts
CHANGED
|
@@ -232,33 +232,15 @@ export class TxEffect {
|
|
|
232
232
|
return thisLayer[0];
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
static async random(
|
|
236
|
-
numPublicCallsPerTx = 3,
|
|
237
|
-
numPublicLogsPerCall = 1,
|
|
238
|
-
maxEffects: number | undefined = undefined,
|
|
239
|
-
): Promise<TxEffect> {
|
|
235
|
+
static async random(numPublicCallsPerTx = 3, numPublicLogsPerCall = 1): Promise<TxEffect> {
|
|
240
236
|
return new TxEffect(
|
|
241
237
|
RevertCode.random(),
|
|
242
238
|
TxHash.random(),
|
|
243
239
|
new Fr(Math.floor(Math.random() * 100_000)),
|
|
244
|
-
makeTuple(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
),
|
|
248
|
-
makeTuple(
|
|
249
|
-
maxEffects === undefined ? MAX_NULLIFIERS_PER_TX : Math.min(maxEffects, MAX_NULLIFIERS_PER_TX),
|
|
250
|
-
Fr.random,
|
|
251
|
-
),
|
|
252
|
-
makeTuple(
|
|
253
|
-
maxEffects === undefined ? MAX_L2_TO_L1_MSGS_PER_TX : Math.min(maxEffects, MAX_L2_TO_L1_MSGS_PER_TX),
|
|
254
|
-
Fr.random,
|
|
255
|
-
),
|
|
256
|
-
makeTuple(
|
|
257
|
-
maxEffects === undefined
|
|
258
|
-
? MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX
|
|
259
|
-
: Math.min(maxEffects, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX),
|
|
260
|
-
PublicDataWrite.random,
|
|
261
|
-
),
|
|
240
|
+
makeTuple(MAX_NOTE_HASHES_PER_TX, Fr.random),
|
|
241
|
+
makeTuple(MAX_NULLIFIERS_PER_TX, Fr.random),
|
|
242
|
+
makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, Fr.random),
|
|
243
|
+
makeTuple(MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PublicDataWrite.random),
|
|
262
244
|
makeTuple(MAX_PRIVATE_LOGS_PER_TX, () => PrivateLog.random()),
|
|
263
245
|
await makeTupleAsync(numPublicCallsPerTx * numPublicLogsPerCall, async () => await PublicLog.random()),
|
|
264
246
|
await makeTupleAsync(MAX_CONTRACT_CLASS_LOGS_PER_TX, ContractClassLog.random),
|
package/src/validators/types.ts
CHANGED
package/src/vks/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './verification_key.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './vk_witness_data.js';
|
|
@@ -7,26 +7,26 @@ import { bufferToHex } from '@aztec/foundation/string';
|
|
|
7
7
|
import type { UInt32 } from '../types/shared.js';
|
|
8
8
|
import { VerificationKeyData } from './verification_key.js';
|
|
9
9
|
|
|
10
|
-
export class
|
|
10
|
+
export class VkWitnessData {
|
|
11
11
|
constructor(
|
|
12
12
|
public vk: VerificationKeyData,
|
|
13
13
|
/**
|
|
14
14
|
* Index of the vk in the vk tree.
|
|
15
15
|
*/
|
|
16
|
-
public
|
|
16
|
+
public vkIndex: UInt32,
|
|
17
17
|
/**
|
|
18
18
|
* Sibling path of the vk in the vk tree.
|
|
19
19
|
*/
|
|
20
|
-
public
|
|
20
|
+
public vkPath: Tuple<Fr, typeof VK_TREE_HEIGHT>,
|
|
21
21
|
) {}
|
|
22
22
|
|
|
23
23
|
static empty() {
|
|
24
|
-
return new
|
|
24
|
+
return new VkWitnessData(VerificationKeyData.empty(), 0, makeTuple(VK_TREE_HEIGHT, Fr.zero));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
28
28
|
const reader = BufferReader.asReader(buffer);
|
|
29
|
-
return new
|
|
29
|
+
return new VkWitnessData(
|
|
30
30
|
reader.readObject(VerificationKeyData),
|
|
31
31
|
reader.readNumber(),
|
|
32
32
|
reader.readArray(VK_TREE_HEIGHT, Fr),
|
|
@@ -34,7 +34,7 @@ export class VkData {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
toBuffer() {
|
|
37
|
-
return serializeToBuffer(this.vk, this.
|
|
37
|
+
return serializeToBuffer(this.vk, this.vkIndex, this.vkPath);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
toString() {
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ViemCommitteeAttestation } from '@aztec/ethereum';
|
|
2
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import { Signature } from '@aztec/foundation/eth-signature';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
export { Signature };
|
|
6
|
-
export { EthAddress };
|
|
7
|
-
export declare class CommitteeAttestation {
|
|
8
|
-
readonly address: EthAddress;
|
|
9
|
-
readonly signature: Signature;
|
|
10
|
-
constructor(address: EthAddress, signature: Signature);
|
|
11
|
-
static get schema(): z.ZodEffects<z.ZodObject<{
|
|
12
|
-
address: z.ZodType<EthAddress, any, string>;
|
|
13
|
-
signature: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>, Signature, string>;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
address: EthAddress;
|
|
16
|
-
signature: Signature;
|
|
17
|
-
}, {
|
|
18
|
-
address: string;
|
|
19
|
-
signature: string;
|
|
20
|
-
}>, CommitteeAttestation, {
|
|
21
|
-
address: string;
|
|
22
|
-
signature: string;
|
|
23
|
-
}>;
|
|
24
|
-
static fromAddress(address: EthAddress): CommitteeAttestation;
|
|
25
|
-
static fromAddressAndSignature(address: EthAddress, signature: Signature): CommitteeAttestation;
|
|
26
|
-
static fromViem(viem: ViemCommitteeAttestation): CommitteeAttestation;
|
|
27
|
-
static fromBuffer(buffer: Buffer): CommitteeAttestation;
|
|
28
|
-
static random(): CommitteeAttestation;
|
|
29
|
-
static empty(): CommitteeAttestation;
|
|
30
|
-
toBuffer(): Buffer;
|
|
31
|
-
equals(other: CommitteeAttestation): boolean;
|
|
32
|
-
toViem(): ViemCommitteeAttestation;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=committee_attestation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"committee_attestation.d.ts","sourceRoot":"","sources":["../../../src/block/proposal/committee_attestation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,qBAAa,oBAAoB;aAEb,OAAO,EAAE,UAAU;aACnB,SAAS,EAAE,SAAS;gBADpB,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,SAAS;IAGtC,MAAM,KAAK,MAAM;;;;;;;;;;;;OAOhB;IAGD,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,oBAAoB;IAK7D,MAAM,CAAC,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,oBAAoB;IAI/F,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,GAAG,oBAAoB;IAIrE,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB;IAOvD,MAAM,CAAC,MAAM,IAAI,oBAAoB;IAKrC,MAAM,CAAC,KAAK,IAAI,oBAAoB;IAIpC,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO;IAI5C,MAAM,IAAI,wBAAwB;CAMnC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import { Signature } from '@aztec/foundation/eth-signature';
|
|
3
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
export { Signature };
|
|
6
|
-
export { EthAddress };
|
|
7
|
-
export class CommitteeAttestation {
|
|
8
|
-
address;
|
|
9
|
-
signature;
|
|
10
|
-
constructor(address, signature){
|
|
11
|
-
this.address = address;
|
|
12
|
-
this.signature = signature;
|
|
13
|
-
}
|
|
14
|
-
static get schema() {
|
|
15
|
-
return z.object({
|
|
16
|
-
address: EthAddress.schema,
|
|
17
|
-
signature: Signature.schema
|
|
18
|
-
}).transform(({ address, signature })=>new CommitteeAttestation(address, signature));
|
|
19
|
-
}
|
|
20
|
-
// Create an empty attestation for an address that has not signed
|
|
21
|
-
static fromAddress(address) {
|
|
22
|
-
return new CommitteeAttestation(address, Signature.empty());
|
|
23
|
-
}
|
|
24
|
-
// Create an attestation from an address and a signature
|
|
25
|
-
static fromAddressAndSignature(address, signature) {
|
|
26
|
-
return new CommitteeAttestation(address, signature);
|
|
27
|
-
}
|
|
28
|
-
static fromViem(viem) {
|
|
29
|
-
return new CommitteeAttestation(EthAddress.fromString(viem.addr), Signature.fromViemSignature(viem.signature));
|
|
30
|
-
}
|
|
31
|
-
static fromBuffer(buffer) {
|
|
32
|
-
const reader = BufferReader.asReader(buffer);
|
|
33
|
-
const address = reader.readObject(EthAddress);
|
|
34
|
-
const signature = reader.readObject(Signature);
|
|
35
|
-
return new CommitteeAttestation(address, signature);
|
|
36
|
-
}
|
|
37
|
-
static random() {
|
|
38
|
-
// note: will be invalid
|
|
39
|
-
return new CommitteeAttestation(EthAddress.random(), Signature.random());
|
|
40
|
-
}
|
|
41
|
-
static empty() {
|
|
42
|
-
return new CommitteeAttestation(EthAddress.ZERO, Signature.empty());
|
|
43
|
-
}
|
|
44
|
-
toBuffer() {
|
|
45
|
-
return serializeToBuffer([
|
|
46
|
-
this.address,
|
|
47
|
-
this.signature
|
|
48
|
-
]);
|
|
49
|
-
}
|
|
50
|
-
equals(other) {
|
|
51
|
-
return this.address.equals(other.address) && this.signature.equals(other.signature);
|
|
52
|
-
}
|
|
53
|
-
toViem() {
|
|
54
|
-
return {
|
|
55
|
-
addr: this.address.toString(),
|
|
56
|
-
signature: this.signature.toViemSignature()
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/block/proposal/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './committee_attestation.js';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { BufferReader, type Tuple } from '@aztec/foundation/serialize';
|
|
4
|
-
import { PrivateLog } from '../logs/index.js';
|
|
5
|
-
export declare class PaddedSideEffects {
|
|
6
|
-
noteHashes: Tuple<Fr, typeof MAX_NOTE_HASHES_PER_TX>;
|
|
7
|
-
nullifiers: Tuple<Fr, typeof MAX_NULLIFIERS_PER_TX>;
|
|
8
|
-
privateLogs: Tuple<PrivateLog, typeof MAX_PRIVATE_LOGS_PER_TX>;
|
|
9
|
-
constructor(noteHashes: Tuple<Fr, typeof MAX_NOTE_HASHES_PER_TX>, nullifiers: Tuple<Fr, typeof MAX_NULLIFIERS_PER_TX>, privateLogs: Tuple<PrivateLog, typeof MAX_PRIVATE_LOGS_PER_TX>);
|
|
10
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
11
|
-
static fromBuffer(buffer: Buffer | BufferReader): PaddedSideEffects;
|
|
12
|
-
static empty(): PaddedSideEffects;
|
|
13
|
-
}
|
|
14
|
-
export declare class PaddedSideEffectAmounts {
|
|
15
|
-
nonRevertibleNoteHashes: number;
|
|
16
|
-
revertibleNoteHashes: number;
|
|
17
|
-
nonRevertibleNullifiers: number;
|
|
18
|
-
revertibleNullifiers: number;
|
|
19
|
-
nonRevertiblePrivateLogs: number;
|
|
20
|
-
revertiblePrivateLogs: number;
|
|
21
|
-
constructor(nonRevertibleNoteHashes: number, revertibleNoteHashes: number, nonRevertibleNullifiers: number, revertibleNullifiers: number, nonRevertiblePrivateLogs: number, revertiblePrivateLogs: number);
|
|
22
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
23
|
-
static fromBuffer(buffer: Buffer | BufferReader): PaddedSideEffectAmounts;
|
|
24
|
-
static empty(): PaddedSideEffectAmounts;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=padded_side_effects.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"padded_side_effects.d.ts","sourceRoot":"","sources":["../../src/kernel/padded_side_effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE1G,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,KAAK,KAAK,EAAqB,MAAM,6BAA6B,CAAC;AAE1F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,qBAAa,iBAAiB;IAEnB,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,sBAAsB,CAAC;IACpD,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,qBAAqB,CAAC;IACnD,WAAW,EAAE,KAAK,CAAC,UAAU,EAAE,OAAO,uBAAuB,CAAC;gBAF9D,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,sBAAsB,CAAC,EACpD,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,qBAAqB,CAAC,EACnD,WAAW,EAAE,KAAK,CAAC,UAAU,EAAE,OAAO,uBAAuB,CAAC;IAGvE,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAS/C,MAAM,CAAC,KAAK;CAOb;AAED,qBAAa,uBAAuB;IAEzB,uBAAuB,EAAE,MAAM;IAC/B,oBAAoB,EAAE,MAAM;IAC5B,uBAAuB,EAAE,MAAM;IAC/B,oBAAoB,EAAE,MAAM;IAC5B,wBAAwB,EAAE,MAAM;IAChC,qBAAqB,EAAE,MAAM;gBAL7B,uBAAuB,EAAE,MAAM,EAC/B,oBAAoB,EAAE,MAAM,EAC5B,uBAAuB,EAAE,MAAM,EAC/B,oBAAoB,EAAE,MAAM,EAC5B,wBAAwB,EAAE,MAAM,EAChC,qBAAqB,EAAE,MAAM;IAGtC,QAAQ;IAWR,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAY/C,MAAM,CAAC,KAAK;CAGb"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
-
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
|
-
import { PrivateLog } from '../logs/index.js';
|
|
6
|
-
export class PaddedSideEffects {
|
|
7
|
-
noteHashes;
|
|
8
|
-
nullifiers;
|
|
9
|
-
privateLogs;
|
|
10
|
-
constructor(noteHashes, nullifiers, privateLogs){
|
|
11
|
-
this.noteHashes = noteHashes;
|
|
12
|
-
this.nullifiers = nullifiers;
|
|
13
|
-
this.privateLogs = privateLogs;
|
|
14
|
-
}
|
|
15
|
-
toBuffer() {
|
|
16
|
-
return serializeToBuffer(this.noteHashes, this.nullifiers, this.privateLogs);
|
|
17
|
-
}
|
|
18
|
-
static fromBuffer(buffer) {
|
|
19
|
-
const reader = BufferReader.asReader(buffer);
|
|
20
|
-
return new PaddedSideEffects(reader.readArray(MAX_NOTE_HASHES_PER_TX, Fr), reader.readArray(MAX_NULLIFIERS_PER_TX, Fr), reader.readArray(MAX_PRIVATE_LOGS_PER_TX, PrivateLog));
|
|
21
|
-
}
|
|
22
|
-
static empty() {
|
|
23
|
-
return new PaddedSideEffects(makeTuple(MAX_NOTE_HASHES_PER_TX, Fr.zero), makeTuple(MAX_NULLIFIERS_PER_TX, Fr.zero), makeTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog.empty));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export class PaddedSideEffectAmounts {
|
|
27
|
-
nonRevertibleNoteHashes;
|
|
28
|
-
revertibleNoteHashes;
|
|
29
|
-
nonRevertibleNullifiers;
|
|
30
|
-
revertibleNullifiers;
|
|
31
|
-
nonRevertiblePrivateLogs;
|
|
32
|
-
revertiblePrivateLogs;
|
|
33
|
-
constructor(nonRevertibleNoteHashes, revertibleNoteHashes, nonRevertibleNullifiers, revertibleNullifiers, nonRevertiblePrivateLogs, revertiblePrivateLogs){
|
|
34
|
-
this.nonRevertibleNoteHashes = nonRevertibleNoteHashes;
|
|
35
|
-
this.revertibleNoteHashes = revertibleNoteHashes;
|
|
36
|
-
this.nonRevertibleNullifiers = nonRevertibleNullifiers;
|
|
37
|
-
this.revertibleNullifiers = revertibleNullifiers;
|
|
38
|
-
this.nonRevertiblePrivateLogs = nonRevertiblePrivateLogs;
|
|
39
|
-
this.revertiblePrivateLogs = revertiblePrivateLogs;
|
|
40
|
-
}
|
|
41
|
-
toBuffer() {
|
|
42
|
-
return serializeToBuffer(this.nonRevertibleNoteHashes, this.revertibleNoteHashes, this.nonRevertibleNullifiers, this.revertibleNullifiers, this.nonRevertiblePrivateLogs, this.revertiblePrivateLogs);
|
|
43
|
-
}
|
|
44
|
-
static fromBuffer(buffer) {
|
|
45
|
-
const reader = BufferReader.asReader(buffer);
|
|
46
|
-
return new PaddedSideEffectAmounts(reader.readNumber(), reader.readNumber(), reader.readNumber(), reader.readNumber(), reader.readNumber(), reader.readNumber());
|
|
47
|
-
}
|
|
48
|
-
static empty() {
|
|
49
|
-
return new PaddedSideEffectAmounts(0, 0, 0, 0, 0, 0);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vk_data.d.ts","sourceRoot":"","sources":["../../src/vks/vk_data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,KAAK,KAAK,EAAqB,MAAM,6BAA6B,CAAC;AAG1F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,MAAM;IAER,EAAE,EAAE,mBAAmB;IAC9B;;OAEG;IACI,SAAS,EAAE,MAAM;IACxB;;OAEG;IACI,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,cAAc,CAAC;gBAR7C,EAAE,EAAE,mBAAmB;IAC9B;;OAEG;IACI,SAAS,EAAE,MAAM;IACxB;;OAEG;IACI,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,cAAc,CAAC;IAGtD,MAAM,CAAC,KAAK;IAIZ,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAS/C,QAAQ;IAIR,QAAQ;CAGT"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { ViemCommitteeAttestation } from '@aztec/ethereum';
|
|
2
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import { Signature } from '@aztec/foundation/eth-signature';
|
|
4
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
|
-
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
|
|
8
|
-
export { Signature };
|
|
9
|
-
export { EthAddress };
|
|
10
|
-
|
|
11
|
-
export class CommitteeAttestation {
|
|
12
|
-
constructor(
|
|
13
|
-
public readonly address: EthAddress,
|
|
14
|
-
public readonly signature: Signature,
|
|
15
|
-
) {}
|
|
16
|
-
|
|
17
|
-
static get schema() {
|
|
18
|
-
return z
|
|
19
|
-
.object({
|
|
20
|
-
address: EthAddress.schema,
|
|
21
|
-
signature: Signature.schema,
|
|
22
|
-
})
|
|
23
|
-
.transform(({ address, signature }) => new CommitteeAttestation(address, signature));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Create an empty attestation for an address that has not signed
|
|
27
|
-
static fromAddress(address: EthAddress): CommitteeAttestation {
|
|
28
|
-
return new CommitteeAttestation(address, Signature.empty());
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Create an attestation from an address and a signature
|
|
32
|
-
static fromAddressAndSignature(address: EthAddress, signature: Signature): CommitteeAttestation {
|
|
33
|
-
return new CommitteeAttestation(address, signature);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static fromViem(viem: ViemCommitteeAttestation): CommitteeAttestation {
|
|
37
|
-
return new CommitteeAttestation(EthAddress.fromString(viem.addr), Signature.fromViemSignature(viem.signature));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static fromBuffer(buffer: Buffer): CommitteeAttestation {
|
|
41
|
-
const reader = BufferReader.asReader(buffer);
|
|
42
|
-
const address = reader.readObject(EthAddress);
|
|
43
|
-
const signature = reader.readObject(Signature);
|
|
44
|
-
return new CommitteeAttestation(address, signature);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
static random(): CommitteeAttestation {
|
|
48
|
-
// note: will be invalid
|
|
49
|
-
return new CommitteeAttestation(EthAddress.random(), Signature.random());
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
static empty(): CommitteeAttestation {
|
|
53
|
-
return new CommitteeAttestation(EthAddress.ZERO, Signature.empty());
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
toBuffer(): Buffer {
|
|
57
|
-
return serializeToBuffer([this.address, this.signature]);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
equals(other: CommitteeAttestation): boolean {
|
|
61
|
-
return this.address.equals(other.address) && this.signature.equals(other.signature);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
toViem(): ViemCommitteeAttestation {
|
|
65
|
-
return {
|
|
66
|
-
addr: this.address.toString(),
|
|
67
|
-
signature: this.signature.toViemSignature(),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './committee_attestation.js';
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
-
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
|
-
|
|
6
|
-
import { PrivateLog } from '../logs/index.js';
|
|
7
|
-
|
|
8
|
-
export class PaddedSideEffects {
|
|
9
|
-
constructor(
|
|
10
|
-
public noteHashes: Tuple<Fr, typeof MAX_NOTE_HASHES_PER_TX>,
|
|
11
|
-
public nullifiers: Tuple<Fr, typeof MAX_NULLIFIERS_PER_TX>,
|
|
12
|
-
public privateLogs: Tuple<PrivateLog, typeof MAX_PRIVATE_LOGS_PER_TX>,
|
|
13
|
-
) {}
|
|
14
|
-
|
|
15
|
-
toBuffer() {
|
|
16
|
-
return serializeToBuffer(this.noteHashes, this.nullifiers, this.privateLogs);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
20
|
-
const reader = BufferReader.asReader(buffer);
|
|
21
|
-
return new PaddedSideEffects(
|
|
22
|
-
reader.readArray(MAX_NOTE_HASHES_PER_TX, Fr),
|
|
23
|
-
reader.readArray(MAX_NULLIFIERS_PER_TX, Fr),
|
|
24
|
-
reader.readArray(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static empty() {
|
|
29
|
-
return new PaddedSideEffects(
|
|
30
|
-
makeTuple(MAX_NOTE_HASHES_PER_TX, Fr.zero),
|
|
31
|
-
makeTuple(MAX_NULLIFIERS_PER_TX, Fr.zero),
|
|
32
|
-
makeTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog.empty),
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export class PaddedSideEffectAmounts {
|
|
38
|
-
constructor(
|
|
39
|
-
public nonRevertibleNoteHashes: number,
|
|
40
|
-
public revertibleNoteHashes: number,
|
|
41
|
-
public nonRevertibleNullifiers: number,
|
|
42
|
-
public revertibleNullifiers: number,
|
|
43
|
-
public nonRevertiblePrivateLogs: number,
|
|
44
|
-
public revertiblePrivateLogs: number,
|
|
45
|
-
) {}
|
|
46
|
-
|
|
47
|
-
toBuffer() {
|
|
48
|
-
return serializeToBuffer(
|
|
49
|
-
this.nonRevertibleNoteHashes,
|
|
50
|
-
this.revertibleNoteHashes,
|
|
51
|
-
this.nonRevertibleNullifiers,
|
|
52
|
-
this.revertibleNullifiers,
|
|
53
|
-
this.nonRevertiblePrivateLogs,
|
|
54
|
-
this.revertiblePrivateLogs,
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
59
|
-
const reader = BufferReader.asReader(buffer);
|
|
60
|
-
return new PaddedSideEffectAmounts(
|
|
61
|
-
reader.readNumber(),
|
|
62
|
-
reader.readNumber(),
|
|
63
|
-
reader.readNumber(),
|
|
64
|
-
reader.readNumber(),
|
|
65
|
-
reader.readNumber(),
|
|
66
|
-
reader.readNumber(),
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static empty() {
|
|
71
|
-
return new PaddedSideEffectAmounts(0, 0, 0, 0, 0, 0);
|
|
72
|
-
}
|
|
73
|
-
}
|