@aztec/stdlib 0.87.7 → 1.0.0-nightly.20250605
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 +1318 -33
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +37 -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 +103 -10
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +25 -10
- package/dest/avm/avm_proving_request.d.ts +648 -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/fees/transaction_fee.d.ts +5 -0
- package/dest/fees/transaction_fee.d.ts.map +1 -1
- package/dest/fees/transaction_fee.js +10 -3
- 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 +652 -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 +37 -4
- package/src/avm/avm_accumulated_data.ts +93 -0
- package/src/avm/avm_circuit_public_inputs.ts +33 -3
- 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/fees/transaction_fee.ts +12 -3
- 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 +82 -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
|
@@ -9,15 +9,15 @@ import { inspect } from 'util';
|
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
|
|
11
11
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
12
|
-
import { Gas, GasSettings } from '../gas/index.js';
|
|
12
|
+
import { Gas, GasFees, GasSettings } from '../gas/index.js';
|
|
13
13
|
import {
|
|
14
14
|
PrivateToAvmAccumulatedData,
|
|
15
15
|
PrivateToAvmAccumulatedDataArrayLengths,
|
|
16
16
|
} from '../kernel/private_to_avm_accumulated_data.js';
|
|
17
|
-
import { PublicCallRequest } from '../kernel/public_call_request.js';
|
|
17
|
+
import { PublicCallRequest, PublicCallRequestArrayLengths } from '../kernel/public_call_request.js';
|
|
18
18
|
import { GlobalVariables } from '../tx/global_variables.js';
|
|
19
19
|
import { TreeSnapshots } from '../tx/tree_snapshots.js';
|
|
20
|
-
import { AvmAccumulatedData } from './avm_accumulated_data.js';
|
|
20
|
+
import { AvmAccumulatedData, AvmAccumulatedDataArrayLengths } from './avm_accumulated_data.js';
|
|
21
21
|
import { serializeWithMessagePack } from './message_pack.js';
|
|
22
22
|
|
|
23
23
|
// Note: the {from,to}{Buffer,Fields,String} methods are needed by AvmProofData and PublicBaseRollupInputs.
|
|
@@ -30,7 +30,9 @@ export class AvmCircuitPublicInputs {
|
|
|
30
30
|
public startTreeSnapshots: TreeSnapshots,
|
|
31
31
|
public startGasUsed: Gas,
|
|
32
32
|
public gasSettings: GasSettings,
|
|
33
|
+
public effectiveGasFees: GasFees,
|
|
33
34
|
public feePayer: AztecAddress,
|
|
35
|
+
public publicCallRequestArrayLengths: PublicCallRequestArrayLengths,
|
|
34
36
|
public publicSetupCallRequests: Tuple<PublicCallRequest, typeof MAX_ENQUEUED_CALLS_PER_TX>,
|
|
35
37
|
public publicAppLogicCallRequests: Tuple<PublicCallRequest, typeof MAX_ENQUEUED_CALLS_PER_TX>,
|
|
36
38
|
public publicTeardownCallRequest: PublicCallRequest,
|
|
@@ -42,6 +44,7 @@ export class AvmCircuitPublicInputs {
|
|
|
42
44
|
// Outputs.
|
|
43
45
|
public endTreeSnapshots: TreeSnapshots,
|
|
44
46
|
public endGasUsed: Gas,
|
|
47
|
+
public accumulatedDataArrayLengths: AvmAccumulatedDataArrayLengths,
|
|
45
48
|
public accumulatedData: AvmAccumulatedData,
|
|
46
49
|
public transactionFee: Fr,
|
|
47
50
|
public reverted: boolean,
|
|
@@ -54,7 +57,9 @@ export class AvmCircuitPublicInputs {
|
|
|
54
57
|
startTreeSnapshots: TreeSnapshots.schema,
|
|
55
58
|
startGasUsed: Gas.schema,
|
|
56
59
|
gasSettings: GasSettings.schema,
|
|
60
|
+
effectiveGasFees: GasFees.schema,
|
|
57
61
|
feePayer: AztecAddress.schema,
|
|
62
|
+
publicCallRequestArrayLengths: PublicCallRequestArrayLengths.schema,
|
|
58
63
|
publicSetupCallRequests: PublicCallRequest.schema.array().max(MAX_ENQUEUED_CALLS_PER_TX),
|
|
59
64
|
publicAppLogicCallRequests: PublicCallRequest.schema.array().max(MAX_ENQUEUED_CALLS_PER_TX),
|
|
60
65
|
publicTeardownCallRequest: PublicCallRequest.schema,
|
|
@@ -64,6 +69,7 @@ export class AvmCircuitPublicInputs {
|
|
|
64
69
|
previousRevertibleAccumulatedData: PrivateToAvmAccumulatedData.schema,
|
|
65
70
|
endTreeSnapshots: TreeSnapshots.schema,
|
|
66
71
|
endGasUsed: Gas.schema,
|
|
72
|
+
accumulatedDataArrayLengths: AvmAccumulatedDataArrayLengths.schema,
|
|
67
73
|
accumulatedData: AvmAccumulatedData.schema,
|
|
68
74
|
transactionFee: schemas.Fr,
|
|
69
75
|
reverted: z.boolean(),
|
|
@@ -74,7 +80,9 @@ export class AvmCircuitPublicInputs {
|
|
|
74
80
|
startTreeSnapshots,
|
|
75
81
|
startGasUsed,
|
|
76
82
|
gasSettings,
|
|
83
|
+
effectiveGasFees,
|
|
77
84
|
feePayer,
|
|
85
|
+
publicCallRequestArrayLengths,
|
|
78
86
|
publicSetupCallRequests,
|
|
79
87
|
publicAppLogicCallRequests,
|
|
80
88
|
publicTeardownCallRequest,
|
|
@@ -84,6 +92,7 @@ export class AvmCircuitPublicInputs {
|
|
|
84
92
|
previousRevertibleAccumulatedData,
|
|
85
93
|
endTreeSnapshots,
|
|
86
94
|
endGasUsed,
|
|
95
|
+
accumulatedDataArrayLengths,
|
|
87
96
|
accumulatedData,
|
|
88
97
|
transactionFee,
|
|
89
98
|
reverted,
|
|
@@ -93,7 +102,9 @@ export class AvmCircuitPublicInputs {
|
|
|
93
102
|
startTreeSnapshots,
|
|
94
103
|
startGasUsed,
|
|
95
104
|
gasSettings,
|
|
105
|
+
effectiveGasFees,
|
|
96
106
|
feePayer,
|
|
107
|
+
publicCallRequestArrayLengths,
|
|
97
108
|
assertLength(publicSetupCallRequests, MAX_ENQUEUED_CALLS_PER_TX),
|
|
98
109
|
assertLength(publicAppLogicCallRequests, MAX_ENQUEUED_CALLS_PER_TX),
|
|
99
110
|
publicTeardownCallRequest,
|
|
@@ -103,6 +114,7 @@ export class AvmCircuitPublicInputs {
|
|
|
103
114
|
previousRevertibleAccumulatedData,
|
|
104
115
|
endTreeSnapshots,
|
|
105
116
|
endGasUsed,
|
|
117
|
+
accumulatedDataArrayLengths,
|
|
106
118
|
accumulatedData,
|
|
107
119
|
transactionFee,
|
|
108
120
|
reverted,
|
|
@@ -117,7 +129,9 @@ export class AvmCircuitPublicInputs {
|
|
|
117
129
|
reader.readObject(TreeSnapshots),
|
|
118
130
|
reader.readObject(Gas),
|
|
119
131
|
reader.readObject(GasSettings),
|
|
132
|
+
reader.readObject(GasFees),
|
|
120
133
|
reader.readObject(AztecAddress),
|
|
134
|
+
reader.readObject(PublicCallRequestArrayLengths),
|
|
121
135
|
reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
122
136
|
reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
123
137
|
reader.readObject(PublicCallRequest),
|
|
@@ -127,6 +141,7 @@ export class AvmCircuitPublicInputs {
|
|
|
127
141
|
reader.readObject(PrivateToAvmAccumulatedData),
|
|
128
142
|
reader.readObject(TreeSnapshots),
|
|
129
143
|
reader.readObject(Gas),
|
|
144
|
+
reader.readObject(AvmAccumulatedDataArrayLengths),
|
|
130
145
|
reader.readObject(AvmAccumulatedData),
|
|
131
146
|
reader.readObject(Fr),
|
|
132
147
|
reader.readBoolean(),
|
|
@@ -139,7 +154,9 @@ export class AvmCircuitPublicInputs {
|
|
|
139
154
|
this.startTreeSnapshots,
|
|
140
155
|
this.startGasUsed,
|
|
141
156
|
this.gasSettings,
|
|
157
|
+
this.effectiveGasFees,
|
|
142
158
|
this.feePayer,
|
|
159
|
+
this.publicCallRequestArrayLengths,
|
|
143
160
|
this.publicSetupCallRequests,
|
|
144
161
|
this.publicAppLogicCallRequests,
|
|
145
162
|
this.publicTeardownCallRequest,
|
|
@@ -149,6 +166,7 @@ export class AvmCircuitPublicInputs {
|
|
|
149
166
|
this.previousRevertibleAccumulatedData,
|
|
150
167
|
this.endTreeSnapshots,
|
|
151
168
|
this.endGasUsed,
|
|
169
|
+
this.accumulatedDataArrayLengths,
|
|
152
170
|
this.accumulatedData,
|
|
153
171
|
this.transactionFee,
|
|
154
172
|
this.reverted,
|
|
@@ -170,7 +188,9 @@ export class AvmCircuitPublicInputs {
|
|
|
170
188
|
TreeSnapshots.fromFields(reader),
|
|
171
189
|
Gas.fromFields(reader),
|
|
172
190
|
GasSettings.fromFields(reader),
|
|
191
|
+
GasFees.fromFields(reader),
|
|
173
192
|
AztecAddress.fromFields(reader),
|
|
193
|
+
PublicCallRequestArrayLengths.fromFields(reader),
|
|
174
194
|
reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
175
195
|
reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
176
196
|
PublicCallRequest.fromFields(reader),
|
|
@@ -180,6 +200,7 @@ export class AvmCircuitPublicInputs {
|
|
|
180
200
|
PrivateToAvmAccumulatedData.fromFields(reader),
|
|
181
201
|
TreeSnapshots.fromFields(reader),
|
|
182
202
|
Gas.fromFields(reader),
|
|
203
|
+
AvmAccumulatedDataArrayLengths.fromFields(reader),
|
|
183
204
|
AvmAccumulatedData.fromFields(reader),
|
|
184
205
|
reader.readField(),
|
|
185
206
|
reader.readBoolean(),
|
|
@@ -192,7 +213,9 @@ export class AvmCircuitPublicInputs {
|
|
|
192
213
|
...this.startTreeSnapshots.toFields(),
|
|
193
214
|
...this.startGasUsed.toFields(),
|
|
194
215
|
...this.gasSettings.toFields(),
|
|
216
|
+
...this.effectiveGasFees.toFields(),
|
|
195
217
|
this.feePayer,
|
|
218
|
+
...this.publicCallRequestArrayLengths.toFields(),
|
|
196
219
|
...this.publicSetupCallRequests.map(request => request.toFields()),
|
|
197
220
|
...this.publicAppLogicCallRequests.map(request => request.toFields()),
|
|
198
221
|
...this.publicTeardownCallRequest.toFields(),
|
|
@@ -202,6 +225,7 @@ export class AvmCircuitPublicInputs {
|
|
|
202
225
|
...this.previousRevertibleAccumulatedData.toFields(),
|
|
203
226
|
...this.endTreeSnapshots.toFields(),
|
|
204
227
|
...this.endGasUsed.toFields(),
|
|
228
|
+
...this.accumulatedDataArrayLengths.toFields(),
|
|
205
229
|
...this.accumulatedData.toFields(),
|
|
206
230
|
this.transactionFee,
|
|
207
231
|
this.reverted,
|
|
@@ -214,7 +238,9 @@ export class AvmCircuitPublicInputs {
|
|
|
214
238
|
TreeSnapshots.empty(),
|
|
215
239
|
Gas.empty(),
|
|
216
240
|
GasSettings.empty(),
|
|
241
|
+
GasFees.empty(),
|
|
217
242
|
AztecAddress.zero(),
|
|
243
|
+
PublicCallRequestArrayLengths.empty(),
|
|
218
244
|
makeTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest.empty),
|
|
219
245
|
makeTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest.empty),
|
|
220
246
|
PublicCallRequest.empty(),
|
|
@@ -224,6 +250,7 @@ export class AvmCircuitPublicInputs {
|
|
|
224
250
|
PrivateToAvmAccumulatedData.empty(),
|
|
225
251
|
TreeSnapshots.empty(),
|
|
226
252
|
Gas.empty(),
|
|
253
|
+
AvmAccumulatedDataArrayLengths.empty(),
|
|
227
254
|
AvmAccumulatedData.empty(),
|
|
228
255
|
Fr.zero(),
|
|
229
256
|
false,
|
|
@@ -240,7 +267,9 @@ export class AvmCircuitPublicInputs {
|
|
|
240
267
|
startTreeSnapshots: ${inspect(this.startTreeSnapshots)},
|
|
241
268
|
startGasUsed: ${inspect(this.startGasUsed)},
|
|
242
269
|
gasSettings: ${inspect(this.gasSettings)},
|
|
270
|
+
effectiveGasFees: ${inspect(this.effectiveGasFees)},
|
|
243
271
|
feePayer: ${inspect(this.feePayer)},
|
|
272
|
+
publicCallRequestArrayLengths: ${inspect(this.publicCallRequestArrayLengths)},
|
|
244
273
|
publicSetupCallRequests: [${this.publicSetupCallRequests
|
|
245
274
|
.filter(x => !x.isEmpty())
|
|
246
275
|
.map(h => inspect(h))
|
|
@@ -258,6 +287,7 @@ export class AvmCircuitPublicInputs {
|
|
|
258
287
|
previousRevertibleAccumulatedData: ${inspect(this.previousRevertibleAccumulatedData)},
|
|
259
288
|
endTreeSnapshots: ${inspect(this.endTreeSnapshots)},
|
|
260
289
|
endGasUsed: ${inspect(this.endGasUsed)},
|
|
290
|
+
accumulatedDataArrayLengths: ${inspect(this.accumulatedDataArrayLengths)},
|
|
261
291
|
accumulatedData: ${inspect(this.accumulatedData)},
|
|
262
292
|
transactionFee: ${inspect(this.transactionFee)},
|
|
263
293
|
reverted: ${this.reverted},
|
package/src/avm/gas.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MAX_L2_GAS_PER_TX_PUBLIC_PORTION } from '@aztec/constants';
|
|
2
|
+
|
|
3
|
+
import { Gas } from '../gas/gas.js';
|
|
4
|
+
import { GasSettings } from '../gas/gas_settings.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Apply L2 gas maximum to the gas settings.
|
|
8
|
+
*/
|
|
9
|
+
export function clampGasSettingsForAVM(gasSettings: GasSettings, gasUsedByPrivate: Gas): GasSettings {
|
|
10
|
+
return new GasSettings(
|
|
11
|
+
clampGasLimitsForAVM(gasSettings.gasLimits, gasUsedByPrivate),
|
|
12
|
+
clampGasLimitsForAVM(gasSettings.teardownGasLimits, new Gas(0, 0)),
|
|
13
|
+
gasSettings.maxFeesPerGas,
|
|
14
|
+
gasSettings.maxPriorityFeesPerGas,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Apply L2 gas maximum to the gas limits.
|
|
20
|
+
*/
|
|
21
|
+
function clampGasLimitsForAVM(gasLimits: Gas, gasUsedByPrivate: Gas): Gas {
|
|
22
|
+
return new Gas(
|
|
23
|
+
/*daGas=*/ gasLimits.daGas,
|
|
24
|
+
/*l2Gas=*/ Math.min(gasLimits.l2Gas, gasUsedByPrivate.l2Gas + MAX_L2_GAS_PER_TX_PUBLIC_PORTION),
|
|
25
|
+
);
|
|
26
|
+
}
|
package/src/avm/index.ts
CHANGED
package/src/block/body.ts
CHANGED
|
@@ -87,9 +87,14 @@ export class Body {
|
|
|
87
87
|
}`;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
static async random(
|
|
90
|
+
static async random(
|
|
91
|
+
txsPerBlock = 4,
|
|
92
|
+
numPublicCallsPerTx = 3,
|
|
93
|
+
numPublicLogsPerCall = 1,
|
|
94
|
+
maxEffects: number | undefined = undefined,
|
|
95
|
+
) {
|
|
91
96
|
const txEffects = await timesParallel(txsPerBlock, () =>
|
|
92
|
-
TxEffect.random(numPublicCallsPerTx, numPublicLogsPerCall),
|
|
97
|
+
TxEffect.random(numPublicCallsPerTx, numPublicLogsPerCall, maxEffects),
|
|
93
98
|
);
|
|
94
99
|
|
|
95
100
|
return new Body(txEffects);
|
package/src/block/index.ts
CHANGED
package/src/block/l2_block.ts
CHANGED
|
@@ -20,6 +20,7 @@ export class L2Block {
|
|
|
20
20
|
public header: BlockHeader,
|
|
21
21
|
/** L2 block body. */
|
|
22
22
|
public body: Body,
|
|
23
|
+
private blockHash: Fr | undefined = undefined,
|
|
23
24
|
) {}
|
|
24
25
|
|
|
25
26
|
static get schema() {
|
|
@@ -86,8 +87,9 @@ export class L2Block {
|
|
|
86
87
|
numPublicLogsPerCall = 1,
|
|
87
88
|
inHash: Buffer | undefined = undefined,
|
|
88
89
|
slotNumber: number | undefined = undefined,
|
|
90
|
+
maxEffects: number | undefined = undefined,
|
|
89
91
|
): Promise<L2Block> {
|
|
90
|
-
const body = await Body.random(txsPerBlock, numPublicCallsPerTx, numPublicLogsPerCall);
|
|
92
|
+
const body = await Body.random(txsPerBlock, numPublicCallsPerTx, numPublicLogsPerCall, maxEffects);
|
|
91
93
|
|
|
92
94
|
return new L2Block(
|
|
93
95
|
makeAppendOnlyTreeSnapshot(l2BlockNum + 1),
|
|
@@ -112,8 +114,11 @@ export class L2Block {
|
|
|
112
114
|
* Returns the block's hash (hash of block header).
|
|
113
115
|
* @returns The block's hash.
|
|
114
116
|
*/
|
|
115
|
-
public hash(): Promise<Fr> {
|
|
116
|
-
|
|
117
|
+
public async hash(): Promise<Fr> {
|
|
118
|
+
if (this.blockHash === undefined) {
|
|
119
|
+
this.blockHash = await this.header.hash();
|
|
120
|
+
}
|
|
121
|
+
return this.blockHash;
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
2
3
|
|
|
3
|
-
import type { EventEmitter } from 'events';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
@@ -127,7 +127,12 @@ export interface L2BlockSource {
|
|
|
127
127
|
* L2BlockSource that emits events upon pending / proven chain changes.
|
|
128
128
|
* see L2BlockSourceEvents for the events emitted.
|
|
129
129
|
*/
|
|
130
|
-
|
|
130
|
+
|
|
131
|
+
export type ArchiverEmitter = TypedEventEmitter<{
|
|
132
|
+
[L2BlockSourceEvents.L2PruneDetected]: (args: L2BlockSourceEvent) => void;
|
|
133
|
+
[L2BlockSourceEvents.L2BlockProven]: (args: L2BlockSourceEvent) => void;
|
|
134
|
+
}>;
|
|
135
|
+
export interface L2BlockSourceEventEmitter extends L2BlockSource, ArchiverEmitter {}
|
|
131
136
|
|
|
132
137
|
/**
|
|
133
138
|
* Identifier for L2 block tags.
|
|
@@ -171,10 +176,11 @@ export const L2TipsSchema = z.object({
|
|
|
171
176
|
|
|
172
177
|
export enum L2BlockSourceEvents {
|
|
173
178
|
L2PruneDetected = 'l2PruneDetected',
|
|
179
|
+
L2BlockProven = 'l2BlockProven',
|
|
174
180
|
}
|
|
175
181
|
|
|
176
182
|
export type L2BlockSourceEvent = {
|
|
177
|
-
type: 'l2PruneDetected';
|
|
183
|
+
type: 'l2PruneDetected' | 'l2BlockProven';
|
|
178
184
|
blockNumber: bigint;
|
|
179
185
|
slotNumber: bigint;
|
|
180
186
|
epochNumber: bigint;
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './committee_attestation.js';
|
|
@@ -1,37 +1,51 @@
|
|
|
1
|
-
import
|
|
1
|
+
// Ignoring import issue to fix portable inferred type issue in zod schema
|
|
2
2
|
import { schemas } from '@aztec/foundation/schemas';
|
|
3
|
-
import { L2Block } from '@aztec/stdlib/block';
|
|
4
3
|
|
|
5
4
|
import { z } from 'zod';
|
|
6
5
|
|
|
7
6
|
import { BlockAttestation } from '../p2p/block_attestation.js';
|
|
8
7
|
import { ConsensusPayload } from '../p2p/consensus_payload.js';
|
|
8
|
+
import { L2Block } from './l2_block.js';
|
|
9
|
+
import { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
9
10
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
export class L1PublishedData {
|
|
12
|
+
constructor(
|
|
13
|
+
public blockNumber: bigint,
|
|
14
|
+
public timestamp: bigint,
|
|
15
|
+
public blockHash: string,
|
|
16
|
+
) {}
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
static get schema() {
|
|
19
|
+
return z.object({
|
|
20
|
+
blockNumber: schemas.BigInt,
|
|
21
|
+
timestamp: schemas.BigInt,
|
|
22
|
+
blockHash: z.string(),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class PublishedL2Block {
|
|
28
|
+
constructor(
|
|
29
|
+
public block: L2Block,
|
|
30
|
+
public l1: L1PublishedData,
|
|
31
|
+
public attestations: CommitteeAttestation[],
|
|
32
|
+
) {}
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
});
|
|
34
|
+
static get schema() {
|
|
35
|
+
return z.object({
|
|
36
|
+
block: L2Block.schema,
|
|
37
|
+
l1: L1PublishedData.schema,
|
|
38
|
+
attestations: z.array(CommitteeAttestation.schema),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
31
42
|
|
|
32
43
|
export function getAttestationsFromPublishedL2Block(block: PublishedL2Block) {
|
|
33
44
|
const payload = ConsensusPayload.fromBlock(block.block);
|
|
34
|
-
return block.
|
|
35
|
-
.filter(
|
|
36
|
-
.map(
|
|
45
|
+
return block.attestations
|
|
46
|
+
.filter(attestation => !attestation.signature.isEmpty())
|
|
47
|
+
.map(
|
|
48
|
+
attestation =>
|
|
49
|
+
new BlockAttestation(block.block.header.globalVariables.blockNumber, payload, attestation.signature),
|
|
50
|
+
);
|
|
37
51
|
}
|
|
@@ -17,7 +17,7 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
17
17
|
const makeBlock = (number: number): PublishedL2Block => ({
|
|
18
18
|
block: { number, header: { hash: () => Promise.resolve(new Fr(number)) } as BlockHeader } as L2Block,
|
|
19
19
|
l1: { blockNumber: BigInt(number), blockHash: `0x${number}`, timestamp: BigInt(number) },
|
|
20
|
-
|
|
20
|
+
attestations: [],
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
const makeBlockId = (number: number): L2BlockId => ({
|
|
@@ -4,7 +4,11 @@ import type { Gas } from '../gas/gas.js';
|
|
|
4
4
|
import { GasFees } from '../gas/gas_fees.js';
|
|
5
5
|
import type { GasSettings } from '../gas/gas_settings.js';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Compute the effective gas fees that should be used to compute the transaction fee.
|
|
9
|
+
* This is the sum of the gas fees and the priority fees, but capped at the max fees per gas.
|
|
10
|
+
*/
|
|
11
|
+
export function computeEffectiveGasFees(gasFees: GasFees, gasSettings: GasSettings): GasFees {
|
|
8
12
|
const { maxFeesPerGas, maxPriorityFeesPerGas } = gasSettings;
|
|
9
13
|
const minField = (f1: Fr, f2: Fr) => (f1.lt(f2) ? f1 : f2);
|
|
10
14
|
const priorityFees = new GasFees(
|
|
@@ -12,10 +16,15 @@ export function computeTransactionFee(gasFees: GasFees, gasSettings: GasSettings
|
|
|
12
16
|
minField(maxPriorityFeesPerGas.feePerL2Gas, maxFeesPerGas.feePerL2Gas.sub(gasFees.feePerL2Gas)),
|
|
13
17
|
);
|
|
14
18
|
|
|
15
|
-
const
|
|
19
|
+
const effectiveFees = new GasFees(
|
|
16
20
|
gasFees.feePerDaGas.add(priorityFees.feePerDaGas),
|
|
17
21
|
gasFees.feePerL2Gas.add(priorityFees.feePerL2Gas),
|
|
18
22
|
);
|
|
19
23
|
|
|
20
|
-
return
|
|
24
|
+
return effectiveFees;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function computeTransactionFee(gasFees: GasFees, gasSettings: GasSettings, gasUsed: Gas): Fr {
|
|
28
|
+
const effectiveFees = computeEffectiveGasFees(gasFees, gasSettings);
|
|
29
|
+
return gasUsed.computeFee(effectiveFees);
|
|
21
30
|
}
|
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
|
|
5
5
|
import { L2Block } from '../block/l2_block.js';
|
|
6
6
|
import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
|
|
7
|
-
import {
|
|
7
|
+
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
8
8
|
import {
|
|
9
9
|
ContractClassPublicSchema,
|
|
10
10
|
type ContractDataSource,
|
|
@@ -45,7 +45,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
45
45
|
getPublishedBlocks: z
|
|
46
46
|
.function()
|
|
47
47
|
.args(schemas.Integer, schemas.Integer, optional(z.boolean()))
|
|
48
|
-
.returns(z.array(
|
|
48
|
+
.returns(z.array(PublishedL2Block.schema)),
|
|
49
49
|
getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
|
|
50
50
|
getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
|
|
51
51
|
getL2SlotNumber: z.function().args().returns(schemas.BigInt),
|
|
@@ -17,7 +17,7 @@ import { type InBlock, inBlockSchemaFor } from '../block/in_block.js';
|
|
|
17
17
|
import { L2Block } from '../block/l2_block.js';
|
|
18
18
|
import { type L2BlockNumber, L2BlockNumberSchema } from '../block/l2_block_number.js';
|
|
19
19
|
import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
20
|
-
import {
|
|
20
|
+
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
21
21
|
import {
|
|
22
22
|
type ContractClassPublic,
|
|
23
23
|
ContractClassPublicSchema,
|
|
@@ -129,19 +129,11 @@ export interface AztecNode
|
|
|
129
129
|
isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
* Returns
|
|
133
|
-
* @dev Membership witness is a consists of the index and the sibling path of the l2ToL1Message.
|
|
134
|
-
* @remarks This tree is considered ephemeral because it is created on-demand by: taking all the l2ToL1 messages
|
|
135
|
-
* in a single block, and then using them to make a variable depth append-only tree with these messages as leaves.
|
|
136
|
-
* The tree is discarded immediately after calculating what we need from it.
|
|
132
|
+
* Returns all the L2 to L1 messages in a block.
|
|
137
133
|
* @param blockNumber - The block number at which to get the data.
|
|
138
|
-
* @
|
|
139
|
-
* @returns A tuple of the index and the sibling path of the L2ToL1Message.
|
|
134
|
+
* @returns The L2 to L1 messages (undefined if the block number is not found).
|
|
140
135
|
*/
|
|
141
|
-
|
|
142
|
-
blockNumber: L2BlockNumber,
|
|
143
|
-
l2ToL1Message: Fr,
|
|
144
|
-
): Promise<[bigint, SiblingPath<number>]>;
|
|
136
|
+
getL2ToL1Messages(blockNumber: L2BlockNumber): Promise<Fr[][] | undefined>;
|
|
145
137
|
|
|
146
138
|
/**
|
|
147
139
|
* Returns a sibling path for a leaf in the committed historic blocks tree.
|
|
@@ -445,10 +437,10 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
445
437
|
|
|
446
438
|
isL1ToL2MessageSynced: z.function().args(schemas.Fr).returns(z.boolean()),
|
|
447
439
|
|
|
448
|
-
|
|
440
|
+
getL2ToL1Messages: z
|
|
449
441
|
.function()
|
|
450
|
-
.args(L2BlockNumberSchema
|
|
451
|
-
.returns(z.
|
|
442
|
+
.args(L2BlockNumberSchema)
|
|
443
|
+
.returns(z.array(z.array(schemas.Fr)).optional()),
|
|
452
444
|
|
|
453
445
|
getArchiveSiblingPath: z
|
|
454
446
|
.function()
|
|
@@ -484,7 +476,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
484
476
|
|
|
485
477
|
getBlocks: z.function().args(z.number(), z.number()).returns(z.array(L2Block.schema)),
|
|
486
478
|
|
|
487
|
-
getPublishedBlocks: z.function().args(z.number(), z.number()).returns(z.array(
|
|
479
|
+
getPublishedBlocks: z.function().args(z.number(), z.number()).returns(z.array(PublishedL2Block.schema)),
|
|
488
480
|
|
|
489
481
|
getCurrentBaseFees: z.function().returns(GasFees.schema),
|
|
490
482
|
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { Timer } from '@aztec/foundation/timer';
|
|
2
3
|
|
|
3
4
|
import type { L2Block } from '../block/l2_block.js';
|
|
5
|
+
import type { AllowedElement } from '../config/index.js';
|
|
6
|
+
import type { Gas } from '../gas/gas.js';
|
|
4
7
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
5
8
|
import type { GlobalVariables } from '../tx/global_variables.js';
|
|
6
|
-
import type { ProcessedTx } from '../tx/processed_tx.js';
|
|
9
|
+
import type { FailedTx, ProcessedTx } from '../tx/processed_tx.js';
|
|
10
|
+
import { Tx } from '../tx/tx.js';
|
|
11
|
+
import type { TxValidator } from '../tx/validator/tx_validator.js';
|
|
7
12
|
import type { ProcessedTxHandler } from './processed-tx-handler.js';
|
|
8
13
|
|
|
9
14
|
/** The interface to a block builder. Generates an L2 block out of a set of processed txs. */
|
|
10
|
-
export interface
|
|
15
|
+
export interface IBlockFactory extends ProcessedTxHandler {
|
|
11
16
|
/**
|
|
12
17
|
* Prepares to build a new block. Updates the L1 to L2 message tree.
|
|
13
18
|
* @param globalVariables - The global variables for this block.
|
|
@@ -31,3 +36,45 @@ export interface BlockBuilder extends ProcessedTxHandler {
|
|
|
31
36
|
*/
|
|
32
37
|
setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2Block>;
|
|
33
38
|
}
|
|
39
|
+
|
|
40
|
+
export interface PublicProcessorLimits {
|
|
41
|
+
maxTransactions?: number;
|
|
42
|
+
maxBlockSize?: number;
|
|
43
|
+
maxBlockGas?: Gas;
|
|
44
|
+
deadline?: Date;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface PublicProcessorValidator {
|
|
48
|
+
preprocessValidator?: TxValidator<Tx>;
|
|
49
|
+
nullifierCache?: { addNullifiers: (nullifiers: Buffer[]) => void };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface BuildBlockOptions extends PublicProcessorLimits {
|
|
53
|
+
txPublicSetupAllowList?: AllowedElement[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface BuildBlockResult {
|
|
57
|
+
block: L2Block;
|
|
58
|
+
publicGas: Gas;
|
|
59
|
+
publicProcessorDuration: number;
|
|
60
|
+
numMsgs: number;
|
|
61
|
+
numTxs: number;
|
|
62
|
+
failedTxs: FailedTx[];
|
|
63
|
+
blockBuildingTimer: Timer;
|
|
64
|
+
usedTxs: Tx[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface IFullNodeBlockBuilder {
|
|
68
|
+
getConfig(): {
|
|
69
|
+
l1GenesisTime: bigint;
|
|
70
|
+
slotDuration: number;
|
|
71
|
+
l1ChainId: number;
|
|
72
|
+
rollupVersion: number;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
buildBlock(
|
|
76
|
+
txs: Iterable<Tx> | AsyncIterable<Tx>,
|
|
77
|
+
globalVariables: GlobalVariables,
|
|
78
|
+
options: BuildBlockOptions,
|
|
79
|
+
): Promise<BuildBlockResult>;
|
|
80
|
+
}
|
|
@@ -5,10 +5,10 @@ import type { Proof } from '../proofs/proof.js';
|
|
|
5
5
|
import type { RootRollupPublicInputs } from '../rollup/root_rollup.js';
|
|
6
6
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
7
7
|
import type { Tx } from '../tx/tx.js';
|
|
8
|
-
import type {
|
|
8
|
+
import type { IBlockFactory } from './block-builder.js';
|
|
9
9
|
|
|
10
10
|
/** Coordinates the proving of an entire epoch. */
|
|
11
|
-
export interface EpochProver extends Omit<
|
|
11
|
+
export interface EpochProver extends Omit<IBlockFactory, 'setBlockCompleted'> {
|
|
12
12
|
/**
|
|
13
13
|
* Starts a new epoch. Must be the first method to be called.
|
|
14
14
|
* @param epochNumber - The epoch number.
|