@aztec/stdlib 4.1.0-rc.4 → 4.2.0-nightly.20260320
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_accumulated_data.js +2 -2
- package/dest/avm/avm_circuit_public_inputs.js +2 -2
- package/dest/checkpoint/validate.js +2 -2
- package/dest/gas/gas_fees.d.ts +1 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +4 -1
- package/dest/hash/hash.d.ts +16 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +24 -0
- package/dest/interfaces/aztec-node-admin.d.ts +4 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +2 -1
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/block-builder.d.ts +25 -6
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +7 -2
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/interfaces/world_state.d.ts +5 -4
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/claimed_length_array.js +1 -1
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts +1 -1
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
- package/dest/kernel/padded_side_effects.js +1 -1
- package/dest/kernel/private_to_avm_accumulated_data.js +2 -2
- package/dest/kernel/private_to_public_accumulated_data.js +2 -2
- package/dest/kernel/private_to_rollup_accumulated_data.js +1 -1
- package/dest/logs/index.d.ts +2 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +1 -0
- package/dest/logs/private_log.js +1 -1
- package/dest/logs/public_log.d.ts +1 -1
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +7 -1
- package/dest/logs/tagging_index_range.d.ts +40 -0
- package/dest/logs/tagging_index_range.d.ts.map +1 -0
- package/dest/logs/tagging_index_range.js +8 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +1 -3
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +0 -7
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/parity/parity_base_private_inputs.js +1 -1
- package/dest/proofs/chonk_proof.d.ts +1 -1
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +7 -1
- package/dest/rollup/base_rollup_hints.js +2 -2
- package/dest/rollup/block_root_rollup_private_inputs.js +5 -5
- package/dest/rollup/checkpoint_rollup_public_inputs.js +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.js +3 -3
- package/dest/rollup/root_rollup_public_inputs.js +1 -1
- package/dest/rollup/tree_snapshot_diff_hints.js +2 -2
- package/dest/tx/private_execution_result.d.ts +6 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +6 -6
- package/dest/tx/profiling.d.ts +14 -2
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +13 -3
- package/dest/tx/protocol_contracts.js +2 -2
- package/dest/vks/vk_data.js +1 -1
- package/package.json +9 -9
- package/src/avm/avm_accumulated_data.ts +6 -6
- package/src/avm/avm_circuit_public_inputs.ts +4 -4
- package/src/checkpoint/validate.ts +2 -2
- package/src/gas/README.md +123 -0
- package/src/gas/gas_fees.ts +7 -1
- package/src/hash/hash.ts +29 -0
- package/src/interfaces/aztec-node.ts +1 -0
- package/src/interfaces/block-builder.ts +27 -3
- package/src/interfaces/configs.ts +4 -1
- package/src/interfaces/world_state.ts +4 -3
- package/src/kernel/claimed_length_array.ts +2 -2
- package/src/kernel/hints/private_kernel_reset_hints.ts +5 -2
- package/src/kernel/hints/read_request_hints.ts +3 -3
- package/src/kernel/padded_side_effects.ts +3 -3
- package/src/kernel/private_to_avm_accumulated_data.ts +4 -4
- package/src/kernel/private_to_public_accumulated_data.ts +10 -10
- package/src/kernel/private_to_rollup_accumulated_data.ts +5 -5
- package/src/logs/index.ts +1 -0
- package/src/logs/private_log.ts +1 -1
- package/src/logs/public_log.ts +11 -1
- package/src/logs/tagging_index_range.ts +24 -0
- package/src/logs/tx_scoped_l2_log.ts +0 -16
- package/src/noir/index.ts +2 -2
- package/src/parity/parity_base_private_inputs.ts +1 -1
- package/src/proofs/chonk_proof.ts +9 -1
- package/src/rollup/base_rollup_hints.ts +2 -2
- package/src/rollup/block_root_rollup_private_inputs.ts +8 -8
- package/src/rollup/checkpoint_rollup_public_inputs.ts +2 -2
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +4 -4
- package/src/rollup/root_rollup_public_inputs.ts +2 -2
- package/src/rollup/tree_snapshot_diff_hints.ts +5 -5
- package/src/tx/private_execution_result.ts +5 -5
- package/src/tx/profiling.ts +11 -2
- package/src/tx/protocol_contracts.ts +2 -2
- package/src/vks/vk_data.ts +1 -1
|
@@ -6,7 +6,7 @@ import { NoteSelector } from '../abi/note_selector.js';
|
|
|
6
6
|
import { PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inputs.js';
|
|
7
7
|
import { sortByCounter } from '../kernel/utils/order_and_comparison.js';
|
|
8
8
|
import { ContractClassLog } from '../logs/contract_class_log.js';
|
|
9
|
-
import {
|
|
9
|
+
import { TaggingIndexRangeSchema } from '../logs/tagging_index_range.js';
|
|
10
10
|
import { Note } from '../note/note.js';
|
|
11
11
|
import { mapSchema, schemas } from '../schemas/index.js';
|
|
12
12
|
import { HashedValues } from './hashed_values.js';
|
|
@@ -100,13 +100,13 @@ export class PrivateExecutionResult {
|
|
|
100
100
|
noteHashNullifierCounterMap;
|
|
101
101
|
returnValues;
|
|
102
102
|
offchainEffects;
|
|
103
|
-
|
|
103
|
+
taggingIndexRanges;
|
|
104
104
|
nestedExecutionResults;
|
|
105
105
|
contractClassLogs;
|
|
106
106
|
profileResult;
|
|
107
107
|
constructor(// Needed for prover
|
|
108
108
|
/** The ACIR bytecode. */ acir, /** The verification key. */ vk, /** The partial witness. */ partialWitness, // Needed for the verifier (kernel)
|
|
109
|
-
/** The call stack item. */ publicInputs, /** The notes created in the executed function. */ newNotes, /** Mapping of note hash counter to the counter of its nullifier. */ noteHashNullifierCounterMap, /** The raw return values of the executed function. */ returnValues, /** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */ offchainEffects, /** The
|
|
109
|
+
/** The call stack item. */ publicInputs, /** The notes created in the executed function. */ newNotes, /** Mapping of note hash counter to the counter of its nullifier. */ noteHashNullifierCounterMap, /** The raw return values of the executed function. */ returnValues, /** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */ offchainEffects, /** The tagging index ranges used in this tx to compute tags for private logs */ taggingIndexRanges, /** The nested executions. */ nestedExecutionResults, /**
|
|
110
110
|
* Contract class logs emitted during execution of this function call.
|
|
111
111
|
* Note: We only need to collect the ContractClassLogFields as preimages for the tx.
|
|
112
112
|
* But keep them as ContractClassLog so that we can verify the log hashes before submitting the tx (TODO).
|
|
@@ -119,7 +119,7 @@ export class PrivateExecutionResult {
|
|
|
119
119
|
this.noteHashNullifierCounterMap = noteHashNullifierCounterMap;
|
|
120
120
|
this.returnValues = returnValues;
|
|
121
121
|
this.offchainEffects = offchainEffects;
|
|
122
|
-
this.
|
|
122
|
+
this.taggingIndexRanges = taggingIndexRanges;
|
|
123
123
|
this.nestedExecutionResults = nestedExecutionResults;
|
|
124
124
|
this.contractClassLogs = contractClassLogs;
|
|
125
125
|
this.profileResult = profileResult;
|
|
@@ -136,13 +136,13 @@ export class PrivateExecutionResult {
|
|
|
136
136
|
offchainEffects: z.array(z.object({
|
|
137
137
|
data: z.array(schemas.Fr)
|
|
138
138
|
})),
|
|
139
|
-
|
|
139
|
+
taggingIndexRanges: z.array(TaggingIndexRangeSchema),
|
|
140
140
|
nestedExecutionResults: z.array(z.lazy(()=>PrivateCallExecutionResult.schema)),
|
|
141
141
|
contractClassLogs: z.array(CountedContractClassLog.schema)
|
|
142
142
|
}).transform(PrivateCallExecutionResult.from);
|
|
143
143
|
}
|
|
144
144
|
static from(fields) {
|
|
145
|
-
return new PrivateCallExecutionResult(fields.acir, fields.vk, fields.partialWitness, fields.publicInputs, fields.newNotes, fields.noteHashNullifierCounterMap, fields.returnValues, fields.offchainEffects, fields.
|
|
145
|
+
return new PrivateCallExecutionResult(fields.acir, fields.vk, fields.partialWitness, fields.publicInputs, fields.newNotes, fields.noteHashNullifierCounterMap, fields.returnValues, fields.offchainEffects, fields.taggingIndexRanges, fields.nestedExecutionResults, fields.contractClassLogs);
|
|
146
146
|
}
|
|
147
147
|
static async random(nested = 1) {
|
|
148
148
|
return new PrivateCallExecutionResult(randomBytes(4), randomBytes(4), new Map([
|
package/dest/tx/profiling.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { type ZodFor } from '@aztec/foundation/schemas';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
4
5
|
import type { AztecNode } from '../interfaces/aztec-node.js';
|
|
5
6
|
import { type PrivateExecutionStep } from '../kernel/private_kernel_prover_output.js';
|
|
6
7
|
export type RoundTripStats = {
|
|
@@ -474,10 +475,21 @@ export declare class TxProfileResult {
|
|
|
474
475
|
}
|
|
475
476
|
export declare class UtilityExecutionResult {
|
|
476
477
|
result: Fr[];
|
|
478
|
+
offchainEffects: {
|
|
479
|
+
data: Fr[];
|
|
480
|
+
contractAddress: AztecAddress;
|
|
481
|
+
}[];
|
|
482
|
+
/** Timestamp of the anchor block used during utility execution. */
|
|
483
|
+
anchorBlockTimestamp: bigint;
|
|
477
484
|
stats?: SimulationStats | undefined;
|
|
478
|
-
constructor(result: Fr[],
|
|
485
|
+
constructor(result: Fr[], offchainEffects: {
|
|
486
|
+
data: Fr[];
|
|
487
|
+
contractAddress: AztecAddress;
|
|
488
|
+
}[],
|
|
489
|
+
/** Timestamp of the anchor block used during utility execution. */
|
|
490
|
+
anchorBlockTimestamp: bigint, stats?: SimulationStats | undefined);
|
|
479
491
|
static get schema(): ZodFor<UtilityExecutionResult>;
|
|
480
492
|
static random(): UtilityExecutionResult;
|
|
481
493
|
}
|
|
482
494
|
export {};
|
|
483
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
495
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsaW5nLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHgvcHJvZmlsaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQXFCLE1BQU0sMkJBQTJCLENBQUM7QUFFM0UsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLEtBQUssQ0FBQztBQUV4QixPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDN0QsT0FBTyxFQUFFLEtBQUssb0JBQW9CLEVBQThCLE1BQU0sMkNBQTJDLENBQUM7QUFFbEgsTUFBTSxNQUFNLGNBQWMsR0FBRztJQUMzQiwwRUFBMEU7SUFDMUUsVUFBVSxFQUFFLE1BQU0sQ0FBQztJQUNuQiw4RUFBOEU7SUFDOUUsaUJBQWlCLEVBQUUsTUFBTSxDQUFDO0lBQzFCLHNDQUFzQztJQUN0QyxrQkFBa0IsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUM3QiwwRUFBMEU7SUFDMUUsZ0JBQWdCLEVBQUUsTUFBTSxFQUFFLEVBQUUsQ0FBQztDQUM5QixDQUF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AE,EACtC,KAAK,EAAE,YAAY,EACxB;IACJ,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,eAAe,CAAC,CAO3C;IAED,MAAM,CAAC,MAAM,IAAI,eAAe,CAsC/B;CACF;AAED,qBAAa,sBAAsB;IAExB,MAAM,EAAE,EAAE,EAAE;IACZ,eAAe,EAAE;QAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAAC,eAAe,EAAE,YAAY,CAAA;KAAE,EAAE;IACvE,mEAAmE;IAC5D,oBAAoB,EAAE,MAAM;IAC5B,KAAK,CAAC;IALf,YACS,MAAM,EAAE,EAAE,EAAE,EACZ,eAAe,EAAE;QAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAAC,eAAe,EAAE,YAAY,CAAA;KAAE,EAAE;IACvE,mEAAmE;IAC5D,oBAAoB,EAAE,MAAM,EAC5B,KAAK,CAAC,6BAAiB,EAC5B;IAEJ,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAYlD;IAED,MAAM,CAAC,MAAM,IAAI,sBAAsB,CAyBtC;CACF"}
|
package/dest/tx/profiling.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { optional, schemas } from '@aztec/foundation/schemas';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
4
5
|
import { PrivateExecutionStepSchema } from '../kernel/private_kernel_prover_output.js';
|
|
5
6
|
const RoundTripStatsSchema = z.object({
|
|
6
7
|
roundTrips: z.number(),
|
|
@@ -113,21 +114,30 @@ export class TxProfileResult {
|
|
|
113
114
|
}
|
|
114
115
|
export class UtilityExecutionResult {
|
|
115
116
|
result;
|
|
117
|
+
offchainEffects;
|
|
118
|
+
anchorBlockTimestamp;
|
|
116
119
|
stats;
|
|
117
|
-
constructor(result, stats){
|
|
120
|
+
constructor(result, offchainEffects, /** Timestamp of the anchor block used during utility execution. */ anchorBlockTimestamp, stats){
|
|
118
121
|
this.result = result;
|
|
122
|
+
this.offchainEffects = offchainEffects;
|
|
123
|
+
this.anchorBlockTimestamp = anchorBlockTimestamp;
|
|
119
124
|
this.stats = stats;
|
|
120
125
|
}
|
|
121
126
|
static get schema() {
|
|
122
127
|
return z.object({
|
|
123
128
|
result: z.array(schemas.Fr),
|
|
129
|
+
offchainEffects: z.array(z.object({
|
|
130
|
+
data: z.array(schemas.Fr),
|
|
131
|
+
contractAddress: AztecAddress.schema
|
|
132
|
+
})),
|
|
133
|
+
anchorBlockTimestamp: schemas.BigInt,
|
|
124
134
|
stats: optional(SimulationStatsSchema)
|
|
125
|
-
}).transform(({ result, stats })=>new UtilityExecutionResult(result, stats));
|
|
135
|
+
}).transform(({ result, offchainEffects, anchorBlockTimestamp, stats })=>new UtilityExecutionResult(result, offchainEffects, anchorBlockTimestamp, stats));
|
|
126
136
|
}
|
|
127
137
|
static random() {
|
|
128
138
|
return new UtilityExecutionResult([
|
|
129
139
|
Fr.random()
|
|
130
|
-
], {
|
|
140
|
+
], [], 0n, {
|
|
131
141
|
nodeRPCCalls: {
|
|
132
142
|
perMethod: {
|
|
133
143
|
getBlockHeader: {
|
|
@@ -20,14 +20,14 @@ export class ProtocolContracts {
|
|
|
20
20
|
}
|
|
21
21
|
static fromFields(fields) {
|
|
22
22
|
const reader = FieldReader.asReader(fields);
|
|
23
|
-
return new ProtocolContracts(reader.
|
|
23
|
+
return new ProtocolContracts(reader.readTuple(MAX_PROTOCOL_CONTRACTS, AztecAddress));
|
|
24
24
|
}
|
|
25
25
|
toFields() {
|
|
26
26
|
return serializeToFields(...ProtocolContracts.getFields(this));
|
|
27
27
|
}
|
|
28
28
|
static fromBuffer(buffer) {
|
|
29
29
|
const reader = BufferReader.asReader(buffer);
|
|
30
|
-
return new ProtocolContracts(reader.
|
|
30
|
+
return new ProtocolContracts(reader.readTuple(MAX_PROTOCOL_CONTRACTS, AztecAddress));
|
|
31
31
|
}
|
|
32
32
|
toBuffer() {
|
|
33
33
|
return serializeToBuffer(...ProtocolContracts.getFields(this));
|
package/dest/vks/vk_data.js
CHANGED
|
@@ -22,7 +22,7 @@ export class VkData {
|
|
|
22
22
|
}
|
|
23
23
|
static fromBuffer(buffer) {
|
|
24
24
|
const reader = BufferReader.asReader(buffer);
|
|
25
|
-
return new VkData(reader.readObject(VerificationKeyData), reader.readNumber(), reader.
|
|
25
|
+
return new VkData(reader.readObject(VerificationKeyData), reader.readNumber(), reader.readTuple(VK_TREE_HEIGHT, Fr));
|
|
26
26
|
}
|
|
27
27
|
toBuffer() {
|
|
28
28
|
return serializeToBuffer(this.vk, this.leafIndex, this.siblingPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0-nightly.20260320",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -90,14 +90,14 @@
|
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
93
|
-
"@aztec/bb.js": "4.
|
|
94
|
-
"@aztec/blob-lib": "4.
|
|
95
|
-
"@aztec/constants": "4.
|
|
96
|
-
"@aztec/ethereum": "4.
|
|
97
|
-
"@aztec/foundation": "4.
|
|
98
|
-
"@aztec/l1-artifacts": "4.
|
|
99
|
-
"@aztec/noir-noirc_abi": "4.
|
|
100
|
-
"@aztec/validator-ha-signer": "4.
|
|
93
|
+
"@aztec/bb.js": "4.2.0-nightly.20260320",
|
|
94
|
+
"@aztec/blob-lib": "4.2.0-nightly.20260320",
|
|
95
|
+
"@aztec/constants": "4.2.0-nightly.20260320",
|
|
96
|
+
"@aztec/ethereum": "4.2.0-nightly.20260320",
|
|
97
|
+
"@aztec/foundation": "4.2.0-nightly.20260320",
|
|
98
|
+
"@aztec/l1-artifacts": "4.2.0-nightly.20260320",
|
|
99
|
+
"@aztec/noir-noirc_abi": "4.2.0-nightly.20260320",
|
|
100
|
+
"@aztec/validator-ha-signer": "4.2.0-nightly.20260320",
|
|
101
101
|
"@google-cloud/storage": "^7.15.0",
|
|
102
102
|
"axios": "^1.13.5",
|
|
103
103
|
"json-stringify-deterministic": "1.0.12",
|
|
@@ -88,11 +88,11 @@ export class AvmAccumulatedData {
|
|
|
88
88
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
89
89
|
const reader = BufferReader.asReader(buffer);
|
|
90
90
|
return new this(
|
|
91
|
-
reader.
|
|
92
|
-
reader.
|
|
93
|
-
reader.
|
|
91
|
+
reader.readTuple(MAX_NOTE_HASHES_PER_TX, Fr),
|
|
92
|
+
reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
|
|
93
|
+
reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
|
|
94
94
|
reader.readObject(FlatPublicLogs),
|
|
95
|
-
reader.
|
|
95
|
+
reader.readTuple(MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PublicDataWrite),
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -115,9 +115,9 @@ export class AvmAccumulatedData {
|
|
|
115
115
|
return new this(
|
|
116
116
|
reader.readFieldArray(MAX_NOTE_HASHES_PER_TX),
|
|
117
117
|
reader.readFieldArray(MAX_NULLIFIERS_PER_TX),
|
|
118
|
-
reader.
|
|
118
|
+
reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
|
|
119
119
|
reader.readObject(FlatPublicLogs),
|
|
120
|
-
reader.
|
|
120
|
+
reader.readTuple(MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PublicDataWrite),
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -143,8 +143,8 @@ export class AvmCircuitPublicInputs {
|
|
|
143
143
|
reader.readObject(AztecAddress),
|
|
144
144
|
reader.readObject(Fr),
|
|
145
145
|
reader.readObject(PublicCallRequestArrayLengths),
|
|
146
|
-
reader.
|
|
147
|
-
reader.
|
|
146
|
+
reader.readTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
147
|
+
reader.readTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
148
148
|
reader.readObject(PublicCallRequest),
|
|
149
149
|
reader.readObject(PrivateToAvmAccumulatedDataArrayLengths),
|
|
150
150
|
reader.readObject(PrivateToAvmAccumulatedDataArrayLengths),
|
|
@@ -206,8 +206,8 @@ export class AvmCircuitPublicInputs {
|
|
|
206
206
|
AztecAddress.fromFields(reader),
|
|
207
207
|
reader.readField(),
|
|
208
208
|
PublicCallRequestArrayLengths.fromFields(reader),
|
|
209
|
-
reader.
|
|
210
|
-
reader.
|
|
209
|
+
reader.readTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
210
|
+
reader.readTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
211
211
|
PublicCallRequest.fromFields(reader),
|
|
212
212
|
PrivateToAvmAccumulatedDataArrayLengths.fromFields(reader),
|
|
213
213
|
PrivateToAvmAccumulatedDataArrayLengths.fromFields(reader),
|
|
@@ -36,7 +36,7 @@ export function validateCheckpoint(
|
|
|
36
36
|
): void {
|
|
37
37
|
validateCheckpointStructure(checkpoint);
|
|
38
38
|
validateCheckpointLimits(checkpoint, opts);
|
|
39
|
-
|
|
39
|
+
validateCheckpointBlocksLimits(checkpoint, opts);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -125,7 +125,7 @@ export function validateCheckpointStructure(checkpoint: Checkpoint): void {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/** Validates checkpoint blocks gas limits */
|
|
128
|
-
function
|
|
128
|
+
function validateCheckpointBlocksLimits(
|
|
129
129
|
checkpoint: Checkpoint,
|
|
130
130
|
opts: {
|
|
131
131
|
maxL2BlockGas?: number;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Aztec Gas and Fee Model
|
|
2
|
+
|
|
3
|
+
The minimum fee per mana and its components are computed on L1 in
|
|
4
|
+
`l1-contracts/src/core/libraries/rollup/FeeLib.sol`. This document describes the
|
|
5
|
+
formulas, the oracle lag/lifetime mechanism, and the TypeScript types in this directory.
|
|
6
|
+
|
|
7
|
+
## Mana
|
|
8
|
+
|
|
9
|
+
Aztec uses **mana** as its unit of work (analogous to Ethereum gas). Transactions consume
|
|
10
|
+
mana in two dimensions: **DA** (data availability) and **L2** (execution). The total fee
|
|
11
|
+
is `gasUsed * feePerMana` summed across both dimensions.
|
|
12
|
+
|
|
13
|
+
## Fee Components
|
|
14
|
+
|
|
15
|
+
The minimum fee per mana has four components:
|
|
16
|
+
|
|
17
|
+
### Sequencer Cost
|
|
18
|
+
|
|
19
|
+
L1 cost to propose a checkpoint (calldata gas + blob data), amortized over `manaTarget`:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
sequencerCost = ((L1_GAS_PER_CHECKPOINT_PROPOSED * baseFee)
|
|
23
|
+
+ (BLOBS_PER_CHECKPOINT * BLOB_GAS_PER_BLOB * blobFee))
|
|
24
|
+
/ manaTarget
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Prover Cost
|
|
28
|
+
|
|
29
|
+
L1 cost to verify an epoch proof, amortized over epoch duration and `manaTarget`, plus a
|
|
30
|
+
governance-set proving cost that compensates for off-chain proof generation:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
proverCost = (L1_GAS_PER_EPOCH_VERIFIED * baseFee / epochDuration) / manaTarget
|
|
34
|
+
+ provingCostPerMana
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Congestion Cost
|
|
38
|
+
|
|
39
|
+
An exponential surcharge when the network is congested (inspired by EIP-1559; the
|
|
40
|
+
implementation uses the `fakeExponential` Taylor series approximation from EIP-4844):
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
baseCost = sequencerCost + proverCost
|
|
44
|
+
congestionCost = baseCost * congestionMultiplier / MINIMUM_CONGESTION_MULTIPLIER - baseCost
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
When there is no congestion the multiplier equals `MINIMUM_CONGESTION_MULTIPLIER` (1e9)
|
|
48
|
+
and congestion cost is zero.
|
|
49
|
+
|
|
50
|
+
### Congestion Multiplier
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
excessMana = max(0, prevExcessMana + prevManaUsed - manaTarget)
|
|
54
|
+
congestionMultiplier = fakeExponential(MINIMUM_CONGESTION_MULTIPLIER, excessMana, denominator)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Each additional `manaTarget` of excess mana increases the multiplier by ~12.5%.
|
|
58
|
+
|
|
59
|
+
### Total
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
minFeePerMana = sequencerCost + proverCost + congestionCost
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## L1 Gas Oracle: Lag and Lifetime
|
|
66
|
+
|
|
67
|
+
The oracle feeds Ethereum's `baseFee` and `blobFee` into the fee model using a two-phase
|
|
68
|
+
(`pre` / `post`) system that smooths out L1 fee volatility.
|
|
69
|
+
|
|
70
|
+
- **LAG = 2 slots** — when new L1 fees are observed, they activate `LAG` slots later
|
|
71
|
+
(`slotOfChange = currentSlot + LAG`). This gives mempool transactions time to land
|
|
72
|
+
before fees change.
|
|
73
|
+
- **LIFETIME = 5 slots** — after an oracle update, the next update is rejected until
|
|
74
|
+
`slotOfChange + (LIFETIME - LAG)` = 3 more slots have passed. This rate-limits how
|
|
75
|
+
frequently L1 fee data can change.
|
|
76
|
+
|
|
77
|
+
Fee resolution at a given timestamp:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
if slot < slotOfChange → use pre (old fees)
|
|
81
|
+
else → use post (new fees)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Net effect**: L1 fee changes reach L2 with a 2-slot delay and can update at most once
|
|
85
|
+
every 5 slots.
|
|
86
|
+
|
|
87
|
+
## Fee Asset Price
|
|
88
|
+
|
|
89
|
+
Fees are computed in ETH internally but converted to the fee asset (Fee Juice) via
|
|
90
|
+
`ethPerFeeAsset` (1e12 precision). The price updates at most ±1% (±100 bps) per
|
|
91
|
+
checkpoint:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
newPrice = currentPrice * (10000 + modifierBps) / 10000
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Maximum Fee Change Rate
|
|
98
|
+
|
|
99
|
+
| Component | Bound |
|
|
100
|
+
| ---------------------- | ------------------------------------------------------- |
|
|
101
|
+
| L1 base fee / blob fee | At most once every 5 slots (oracle LIFETIME) |
|
|
102
|
+
| Fee asset price | ±1% per checkpoint |
|
|
103
|
+
| Congestion multiplier | Depends on excess mana accumulation/drain per checkpoint |
|
|
104
|
+
| Sequencer/prover costs | Scale linearly with L1 fees |
|
|
105
|
+
|
|
106
|
+
## Key Constants
|
|
107
|
+
|
|
108
|
+
| Constant | Value |
|
|
109
|
+
| ------------------------------ | -------------- |
|
|
110
|
+
| `L1_GAS_PER_CHECKPOINT_PROPOSED` | 300,000 |
|
|
111
|
+
| `L1_GAS_PER_EPOCH_VERIFIED` | 3,600,000 |
|
|
112
|
+
| `BLOBS_PER_CHECKPOINT` | 3 |
|
|
113
|
+
| `BLOB_GAS_PER_BLOB` | 2^17 |
|
|
114
|
+
| `MINIMUM_CONGESTION_MULTIPLIER` | 1e9 |
|
|
115
|
+
| `LAG` | 2 slots |
|
|
116
|
+
| `LIFETIME` | 5 slots |
|
|
117
|
+
|
|
118
|
+
## TypeScript Types
|
|
119
|
+
|
|
120
|
+
- **`Gas`** — mana quantity in two dimensions (`daGas`, `l2Gas`).
|
|
121
|
+
- **`GasFees`** — per-unit price in each dimension (`feePerDaGas`, `feePerL2Gas`).
|
|
122
|
+
- **`GasSettings`** — sender-chosen fee parameters: gas limits, teardown limits, max fees, priority fees.
|
|
123
|
+
- **`GasUsed`** — actual consumption after execution. Note: `billedGas` uses the teardown gas *limit*, not actual usage.
|
package/src/gas/gas_fees.ts
CHANGED
|
@@ -56,8 +56,14 @@ export class GasFees {
|
|
|
56
56
|
return this.clone();
|
|
57
57
|
} else if (typeof scalar === 'bigint') {
|
|
58
58
|
return new GasFees(this.feePerDaGas * scalar, this.feePerL2Gas * scalar);
|
|
59
|
+
} else if (Number.isInteger(scalar)) {
|
|
60
|
+
const s = BigInt(scalar);
|
|
61
|
+
return new GasFees(this.feePerDaGas * s, this.feePerL2Gas * s);
|
|
59
62
|
} else {
|
|
60
|
-
return new GasFees(
|
|
63
|
+
return new GasFees(
|
|
64
|
+
BigInt(Math.ceil(Number(this.feePerDaGas) * scalar)),
|
|
65
|
+
BigInt(Math.ceil(Number(this.feePerL2Gas) * scalar)),
|
|
66
|
+
);
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
|
package/src/hash/hash.ts
CHANGED
|
@@ -58,6 +58,35 @@ export function siloNullifier(contract: AztecAddress, innerNullifier: Fr): Promi
|
|
|
58
58
|
return poseidon2HashWithSeparator([contract, innerNullifier], DomainSeparator.SILOED_NULLIFIER);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Computes the siloed private initialization nullifier for a contract, given its address and initialization hash.
|
|
63
|
+
* @param contract - The contract address.
|
|
64
|
+
* @param initializationHash - The contract's initialization hash.
|
|
65
|
+
* @returns The siloed private initialization nullifier.
|
|
66
|
+
*/
|
|
67
|
+
export async function computeSiloedPrivateInitializationNullifier(
|
|
68
|
+
contract: AztecAddress,
|
|
69
|
+
initializationHash: Fr,
|
|
70
|
+
): Promise<Fr> {
|
|
71
|
+
const innerNullifier = await poseidon2HashWithSeparator(
|
|
72
|
+
[contract, initializationHash],
|
|
73
|
+
DomainSeparator.PRIVATE_INITIALIZATION_NULLIFIER,
|
|
74
|
+
);
|
|
75
|
+
return siloNullifier(contract, innerNullifier);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Computes the siloed public initialization nullifier for a contract. Not all contracts emit this nullifier: it is only
|
|
80
|
+
* emitted when the contract has public functions that perform initialization checks (i.e. external public functions that
|
|
81
|
+
* are not `#[noinitcheck]` or `#[only_self]`).
|
|
82
|
+
* @param contract - The contract address.
|
|
83
|
+
* @returns The siloed public initialization nullifier.
|
|
84
|
+
*/
|
|
85
|
+
export async function computeSiloedPublicInitializationNullifier(contract: AztecAddress): Promise<Fr> {
|
|
86
|
+
const innerNullifier = await poseidon2HashWithSeparator([contract], DomainSeparator.PUBLIC_INITIALIZATION_NULLIFIER);
|
|
87
|
+
return siloNullifier(contract, innerNullifier);
|
|
88
|
+
}
|
|
89
|
+
|
|
61
90
|
/**
|
|
62
91
|
* Computes the protocol nullifier, which is the hash of the initial tx request siloed with the null msg sender address.
|
|
63
92
|
* @param txRequestHash - The hash of the initial tx request.
|
|
@@ -122,6 +122,7 @@ export interface AztecNode
|
|
|
122
122
|
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
123
123
|
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
124
124
|
* @returns The low nullifier membership witness (if found).
|
|
125
|
+
* @throws If the nullifier already exists in the tree, since non-inclusion cannot be proven.
|
|
125
126
|
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
126
127
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
127
128
|
* we are trying to prove non-inclusion for.
|
|
@@ -35,7 +35,8 @@ export interface IBlockFactory extends ProcessedTxHandler {
|
|
|
35
35
|
setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2Block>;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/** Limits passed to the public processor for tx processing within a block. */
|
|
39
|
+
export type PublicProcessorLimits = {
|
|
39
40
|
/** Maximum number of txs to process. */
|
|
40
41
|
maxTransactions?: number;
|
|
41
42
|
/** L2 and DA gas limits. */
|
|
@@ -46,7 +47,30 @@ export interface PublicProcessorLimits {
|
|
|
46
47
|
deadline?: Date;
|
|
47
48
|
/** Whether this processor is building a proposal (as opposed to re-executing one). Skipping txs due to gas or blob limits is only done during proposal building. */
|
|
48
49
|
isBuildingProposal?: boolean;
|
|
49
|
-
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Base fields shared by both proposer and validator block builder options. */
|
|
53
|
+
type BlockBuilderOptionsBase = PublicProcessorLimits & {
|
|
54
|
+
/** Minimum number of successfully processed txs required. Block is rejected if fewer succeed. */
|
|
55
|
+
minValidTxs: number;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Proposer mode: redistribution params are required. */
|
|
59
|
+
type ProposerBlockBuilderOptions = BlockBuilderOptionsBase & {
|
|
60
|
+
isBuildingProposal: true;
|
|
61
|
+
/** Maximum number of blocks per checkpoint, derived from the timetable. */
|
|
62
|
+
maxBlocksPerCheckpoint: number;
|
|
63
|
+
/** Per-block gas budget multiplier. Budget = (remaining / remainingBlocks) * multiplier. */
|
|
64
|
+
perBlockAllocationMultiplier: number;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** Validator mode: no redistribution params needed. */
|
|
68
|
+
type ValidatorBlockBuilderOptions = BlockBuilderOptionsBase & {
|
|
69
|
+
isBuildingProposal: false;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/** Options for building a block within a checkpoint. When proposing, redistribution params are required. */
|
|
73
|
+
export type BlockBuilderOptions = ProposerBlockBuilderOptions | ValidatorBlockBuilderOptions;
|
|
50
74
|
|
|
51
75
|
export interface PublicProcessorValidator {
|
|
52
76
|
preprocessValidator?: TxValidator<Tx>;
|
|
@@ -109,7 +133,7 @@ export interface ICheckpointBlockBuilder {
|
|
|
109
133
|
pendingTxs: Iterable<Tx> | AsyncIterable<Tx>,
|
|
110
134
|
blockNumber: BlockNumber,
|
|
111
135
|
timestamp: bigint,
|
|
112
|
-
opts:
|
|
136
|
+
opts: BlockBuilderOptions,
|
|
113
137
|
): Promise<BuildBlockInCheckpointResult>;
|
|
114
138
|
}
|
|
115
139
|
|
|
@@ -27,6 +27,8 @@ export interface SequencerConfig {
|
|
|
27
27
|
maxDABlockGas?: number;
|
|
28
28
|
/** Per-block gas budget multiplier for both L2 and DA gas. Budget = (checkpointLimit / maxBlocks) * multiplier. */
|
|
29
29
|
perBlockAllocationMultiplier?: number;
|
|
30
|
+
/** Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget. */
|
|
31
|
+
redistributeCheckpointBudget?: boolean;
|
|
30
32
|
/** Recipient of block reward. */
|
|
31
33
|
coinbase?: EthAddress;
|
|
32
34
|
/** Address to receive fees. */
|
|
@@ -94,6 +96,7 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
|
|
|
94
96
|
publishTxsWithProposals: z.boolean().optional(),
|
|
95
97
|
maxDABlockGas: z.number().optional(),
|
|
96
98
|
perBlockAllocationMultiplier: z.number().optional(),
|
|
99
|
+
redistributeCheckpointBudget: z.boolean().optional(),
|
|
97
100
|
coinbase: schemas.EthAddress.optional(),
|
|
98
101
|
feeRecipient: schemas.AztecAddress.optional(),
|
|
99
102
|
acvmWorkingDirectory: z.string().optional(),
|
|
@@ -142,7 +145,7 @@ type SequencerConfigOptionalKeys =
|
|
|
142
145
|
| 'maxTxsPerCheckpoint'
|
|
143
146
|
| 'maxL2BlockGas'
|
|
144
147
|
| 'maxDABlockGas'
|
|
145
|
-
| '
|
|
148
|
+
| 'redistributeCheckpointBudget';
|
|
146
149
|
|
|
147
150
|
export type ResolvedSequencerConfig = Prettify<
|
|
148
151
|
Required<Omit<SequencerConfig, SequencerConfigOptionalKeys>> & Pick<SequencerConfig, SequencerConfigOptionalKeys>
|
|
@@ -3,6 +3,7 @@ import type { PromiseWithResolvers } from '@aztec/foundation/promise';
|
|
|
3
3
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
+
import type { BlockHash } from '../block/block_hash.js';
|
|
6
7
|
import type { SnapshotDataKeys } from '../snapshots/types.js';
|
|
7
8
|
import type { MerkleTreeReadOperations, MerkleTreeWriteOperations } from './merkle_tree_operations.js';
|
|
8
9
|
|
|
@@ -80,12 +81,12 @@ export interface WorldStateSynchronizer extends ReadonlyWorldStateAccess, ForkMe
|
|
|
80
81
|
resumeSync(): void;
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
|
-
* Forces an immediate sync to an optionally provided minimum block number
|
|
84
|
+
* Forces an immediate sync to an optionally provided minimum block number.
|
|
84
85
|
* @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
|
|
85
|
-
* @param
|
|
86
|
+
* @param blockHash - If provided, verifies the block at targetBlockNumber matches this hash. On mismatch, triggers a resync (reorg detection).
|
|
86
87
|
* @returns A promise that resolves with the block number the world state was synced to
|
|
87
88
|
*/
|
|
88
|
-
syncImmediate(minBlockNumber?: BlockNumber,
|
|
89
|
+
syncImmediate(minBlockNumber?: BlockNumber, blockHash?: BlockHash): Promise<BlockNumber>;
|
|
89
90
|
|
|
90
91
|
/** Deletes the db */
|
|
91
92
|
clear(): Promise<void>;
|
|
@@ -25,7 +25,7 @@ export class ClaimedLengthArray<T extends Serializable, N extends number> {
|
|
|
25
25
|
arrayLength: N,
|
|
26
26
|
): ClaimedLengthArray<T, N> {
|
|
27
27
|
const reader = BufferReader.asReader(buffer);
|
|
28
|
-
const array = reader.readArray(arrayLength, deserializer)
|
|
28
|
+
const array = reader.readArray(arrayLength, deserializer) as Tuple<T, N>;
|
|
29
29
|
const claimedLength = reader.readNumber();
|
|
30
30
|
return new ClaimedLengthArray(array, claimedLength);
|
|
31
31
|
}
|
|
@@ -42,7 +42,7 @@ export class ClaimedLengthArray<T extends Serializable, N extends number> {
|
|
|
42
42
|
arrayLength: N,
|
|
43
43
|
): ClaimedLengthArray<T, N> {
|
|
44
44
|
const reader = FieldReader.asReader(fields);
|
|
45
|
-
const array = reader.
|
|
45
|
+
const array = reader.readTuple(arrayLength, deserializer);
|
|
46
46
|
const claimedLength = reader.readU32();
|
|
47
47
|
return new ClaimedLengthArray(array, claimedLength);
|
|
48
48
|
}
|
|
@@ -105,8 +105,11 @@ export class PrivateKernelResetHints<
|
|
|
105
105
|
fromBuffer: buf =>
|
|
106
106
|
nullifierReadRequestHintsFromBuffer(buf, numNullifierReadRequestPending, numNullifierReadRequestSettled),
|
|
107
107
|
}),
|
|
108
|
-
reader.readArray(numKeyValidationHints, KeyValidationHint),
|
|
109
|
-
reader.readArray(numTransientDataSquashingHints, TransientDataSquashingHint)
|
|
108
|
+
reader.readArray(numKeyValidationHints, KeyValidationHint) as Tuple<KeyValidationHint, KEY_VALIDATION_HINTS_LEN>,
|
|
109
|
+
reader.readArray(numTransientDataSquashingHints, TransientDataSquashingHint) as Tuple<
|
|
110
|
+
TransientDataSquashingHint,
|
|
111
|
+
TRANSIENT_DATA_HINTS_LEN
|
|
112
|
+
>,
|
|
110
113
|
);
|
|
111
114
|
}
|
|
112
115
|
}
|
|
@@ -158,11 +158,11 @@ export class ReadRequestResetHints<
|
|
|
158
158
|
> {
|
|
159
159
|
const reader = BufferReader.asReader(buffer);
|
|
160
160
|
return new ReadRequestResetHints(
|
|
161
|
-
reader.readArray(readRequestLen, ReadRequestAction),
|
|
162
|
-
reader.readArray(numPendingReads, PendingReadHint),
|
|
161
|
+
reader.readArray(readRequestLen, ReadRequestAction) as Tuple<ReadRequestAction, READ_REQUEST_LEN>,
|
|
162
|
+
reader.readArray(numPendingReads, PendingReadHint) as Tuple<PendingReadHint, PENDING_READ_HINTS_LEN>,
|
|
163
163
|
reader.readArray(numSettledReads, {
|
|
164
164
|
fromBuffer: r => SettledReadHint.fromBuffer(r, treeHeight, leafPreimageFromBuffer),
|
|
165
|
-
}),
|
|
165
|
+
}) as Tuple<SettledReadHint<TREE_HEIGHT, LEAF_PREIMAGE>, SETTLED_READ_HINTS_LEN>,
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -19,9 +19,9 @@ export class PaddedSideEffects {
|
|
|
19
19
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
20
20
|
const reader = BufferReader.asReader(buffer);
|
|
21
21
|
return new PaddedSideEffects(
|
|
22
|
-
reader.
|
|
23
|
-
reader.
|
|
24
|
-
reader.
|
|
22
|
+
reader.readTuple(MAX_NOTE_HASHES_PER_TX, Fr),
|
|
23
|
+
reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
|
|
24
|
+
reader.readTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|