@aztec/stdlib 0.0.1-commit.3100065 → 0.0.1-commit.321f6a9
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 +8 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/contract_artifact.d.ts +1 -14
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +26 -25
- package/dest/avm/avm_proving_request.d.ts +70 -70
- package/dest/avm/index.d.ts +1 -6
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +0 -5
- package/dest/contract/contract_class.d.ts +1 -1
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/contract/contract_class.js +3 -2
- package/dest/contract/index.d.ts +1 -2
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -1
- package/dest/interfaces/block-builder.d.ts +7 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +8 -3
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/private_kernel_prover.d.ts +64 -3
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +1 -1
- package/dest/interfaces/server.d.ts +1 -2
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +0 -1
- package/dest/kernel/hints/index.d.ts +1 -2
- package/dest/kernel/hints/index.d.ts.map +1 -1
- package/dest/kernel/hints/index.js +0 -1
- package/dest/kernel/index.d.ts +5 -1
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +4 -0
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +1 -9
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +3 -7
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts +24 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.js +37 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts +25 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.js +39 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts +18 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.js +27 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts +19 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.js +29 -0
- package/dest/kernel/private_kernel_prover_output.d.ts +4 -1
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_prover_output.js +4 -1
- package/dest/kernel/private_kernel_simulated_output.d.ts +1 -7
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_simulated_output.js +2 -1
- package/dest/kernel/utils/index.d.ts +1 -2
- package/dest/kernel/utils/index.d.ts.map +1 -1
- package/dest/kernel/utils/index.js +0 -1
- package/dest/logs/index.d.ts +3 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +2 -0
- package/dest/logs/message_context.d.ts +17 -0
- package/dest/logs/message_context.d.ts.map +1 -0
- package/dest/logs/message_context.js +9 -0
- package/dest/logs/pending_tagged_log.d.ts +11 -0
- package/dest/logs/pending_tagged_log.d.ts.map +1 -0
- package/dest/logs/pending_tagged_log.js +4 -0
- package/dest/logs/shared_secret_derivation.d.ts +12 -2
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +18 -0
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/p2p/index.d.ts +1 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +0 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +1 -1
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +1 -27
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +0 -30
- package/dest/tx/index.d.ts +1 -2
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/profiling.d.ts +1 -1
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +2 -0
- package/dest/world-state/world_state_revision.d.ts +1 -18
- package/dest/world-state/world_state_revision.d.ts.map +1 -1
- package/dest/world-state/world_state_revision.js +0 -20
- package/package.json +8 -8
- package/src/abi/abi.ts +8 -0
- package/src/abi/contract_artifact.ts +33 -28
- package/src/avm/index.ts +0 -5
- package/src/contract/contract_class.ts +3 -2
- package/src/contract/index.ts +0 -1
- package/src/gas/README.md +108 -36
- package/src/interfaces/block-builder.ts +6 -1
- package/src/interfaces/merkle_tree_operations.ts +8 -2
- package/src/interfaces/private_kernel_prover.ts +94 -1
- package/src/interfaces/server.ts +0 -1
- package/src/kernel/hints/index.ts +0 -1
- package/src/kernel/index.ts +4 -0
- package/src/kernel/private_kernel_circuit_public_inputs.ts +0 -7
- package/src/kernel/private_kernel_init_4_circuit_private_inputs.ts +52 -0
- package/src/kernel/private_kernel_init_5_circuit_private_inputs.ts +55 -0
- package/src/kernel/private_kernel_inner_4_circuit_private_inputs.ts +39 -0
- package/src/kernel/private_kernel_inner_5_circuit_private_inputs.ts +42 -0
- package/src/kernel/private_kernel_prover_output.ts +4 -0
- package/src/kernel/private_kernel_simulated_output.ts +0 -7
- package/src/kernel/utils/index.ts +0 -1
- package/src/logs/index.ts +2 -0
- package/src/logs/message_context.ts +18 -0
- package/src/logs/pending_tagged_log.ts +12 -0
- package/src/logs/shared_secret_derivation.ts +18 -1
- package/src/noir/index.ts +2 -1
- package/src/p2p/index.ts +0 -1
- package/src/stats/stats.ts +4 -0
- package/src/tests/factories.ts +0 -38
- package/src/tx/index.ts +0 -1
- package/src/tx/profiling.ts +2 -0
- package/src/world-state/world_state_revision.ts +0 -33
- package/dest/avm/contract_storage_read.d.ts +0 -58
- package/dest/avm/contract_storage_read.d.ts.map +0 -1
- package/dest/avm/contract_storage_read.js +0 -65
- package/dest/avm/contract_storage_update_request.d.ts +0 -65
- package/dest/avm/contract_storage_update_request.d.ts.map +0 -1
- package/dest/avm/contract_storage_update_request.js +0 -80
- package/dest/avm/public_call_stack_item_compressed.d.ts +0 -43
- package/dest/avm/public_call_stack_item_compressed.d.ts.map +0 -1
- package/dest/avm/public_call_stack_item_compressed.js +0 -70
- package/dest/avm/public_data_update_request.d.ts +0 -62
- package/dest/avm/public_data_update_request.d.ts.map +0 -1
- package/dest/avm/public_data_update_request.js +0 -67
- package/dest/avm/public_inner_call_request.d.ts +0 -50
- package/dest/avm/public_inner_call_request.d.ts.map +0 -1
- package/dest/avm/public_inner_call_request.js +0 -74
- package/dest/contract/deployment_info.d.ts +0 -24
- package/dest/contract/deployment_info.d.ts.map +0 -1
- package/dest/contract/deployment_info.js +0 -3
- package/dest/interfaces/prover-coordination.d.ts +0 -15
- package/dest/interfaces/prover-coordination.d.ts.map +0 -1
- package/dest/interfaces/prover-coordination.js +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.d.ts +0 -14
- package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.js +0 -33
- package/dest/kernel/utils/optional_number.d.ts +0 -31
- package/dest/kernel/utils/optional_number.d.ts.map +0 -1
- package/dest/kernel/utils/optional_number.js +0 -42
- package/dest/p2p/interface.d.ts +0 -5
- package/dest/p2p/interface.d.ts.map +0 -1
- package/dest/p2p/interface.js +0 -1
- package/dest/tx/validator/empty_validator.d.ts +0 -5
- package/dest/tx/validator/empty_validator.d.ts.map +0 -1
- package/dest/tx/validator/empty_validator.js +0 -7
- package/src/avm/contract_storage_read.ts +0 -77
- package/src/avm/contract_storage_update_request.ts +0 -93
- package/src/avm/public_call_stack_item_compressed.ts +0 -113
- package/src/avm/public_data_update_request.ts +0 -106
- package/src/avm/public_inner_call_request.ts +0 -85
- package/src/contract/deployment_info.ts +0 -25
- package/src/interfaces/prover-coordination.ts +0 -17
- package/src/kernel/hints/tree_leaf_read_request.ts +0 -35
- package/src/kernel/utils/optional_number.ts +0 -50
- package/src/p2p/interface.ts +0 -4
- package/src/tx/validator/empty_validator.ts +0 -7
package/src/gas/README.md
CHANGED
|
@@ -1,47 +1,69 @@
|
|
|
1
1
|
# Aztec Gas and Fee Model
|
|
2
2
|
|
|
3
3
|
The minimum fee per mana and its components are computed on L1 in
|
|
4
|
-
`l1-contracts/src/core/libraries/rollup/FeeLib.sol
|
|
5
|
-
|
|
4
|
+
`l1-contracts/src/core/libraries/rollup/FeeLib.sol` (`fee_math.ts` in this directory is a
|
|
5
|
+
TypeScript port of those formulas, used to predict fees a few slots ahead). This document
|
|
6
|
+
describes the formulas, the oracle lag/lifetime mechanism, how a transaction's fee is
|
|
7
|
+
derived from them, the gas and data limits, and the TypeScript types in this directory.
|
|
6
8
|
|
|
7
9
|
## Mana
|
|
8
10
|
|
|
9
|
-
Aztec
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
Aztec meters work as gas in two dimensions: **DA** (data availability, i.e. blob data
|
|
12
|
+
published to L1) and **L2** (execution). The L2 dimension is called **mana** (analogous to
|
|
13
|
+
Ethereum gas): block headers track `totalManaUsed`, and the fee model below prices one unit
|
|
14
|
+
of mana. The total fee is `gasUsed * feePerGas` summed across both dimensions.
|
|
15
|
+
|
|
16
|
+
### The DA dimension is priced at zero
|
|
17
|
+
|
|
18
|
+
Only the L2 dimension currently carries a price. When building checkpoint global variables,
|
|
19
|
+
the sequencer sets `feePerDaGas = 0` and sets `feePerL2Gas` to the L1-computed minimum fee
|
|
20
|
+
per mana (`sequencer-client/src/global_variable_builder/global_builder.ts` and
|
|
21
|
+
`fee_provider.ts` in the same directory). The cost of publishing data is still recovered:
|
|
22
|
+
the blob gas a checkpoint pays on L1 is part of the *sequencer cost* component of the mana
|
|
23
|
+
fee below. DA gas remains fully metered and limited (see
|
|
24
|
+
[Gas and Data Limits](#gas-and-data-limits)) — it bounds how much data a tx or checkpoint
|
|
25
|
+
may publish — it just contributes nothing to the fee today.
|
|
12
26
|
|
|
13
27
|
## Fee Components
|
|
14
28
|
|
|
15
|
-
The minimum fee per mana has four components
|
|
29
|
+
The minimum fee per mana has four components. All are computed in ETH (wei) per mana and
|
|
30
|
+
converted to the fee asset at the end (see [Fee Asset Price](#fee-asset-price)).
|
|
16
31
|
|
|
17
32
|
### Sequencer Cost
|
|
18
33
|
|
|
19
34
|
L1 cost to propose a checkpoint (calldata gas + blob data), amortized over `manaTarget`:
|
|
20
35
|
|
|
21
36
|
```
|
|
22
|
-
sequencerCost = ((L1_GAS_PER_CHECKPOINT_PROPOSED * baseFee)
|
|
37
|
+
sequencerCost = ceil(((L1_GAS_PER_CHECKPOINT_PROPOSED * baseFee)
|
|
23
38
|
+ (BLOBS_PER_CHECKPOINT * BLOB_GAS_PER_BLOB * blobFee))
|
|
24
|
-
/ manaTarget
|
|
39
|
+
/ manaTarget)
|
|
25
40
|
```
|
|
26
41
|
|
|
42
|
+
Note that `BLOBS_PER_CHECKPOINT` here is FeeLib's own constant (3), not the protocol blob
|
|
43
|
+
capacity of the same name (6) — see the note under [Key Constants](#key-constants).
|
|
44
|
+
|
|
27
45
|
### Prover Cost
|
|
28
46
|
|
|
29
47
|
L1 cost to verify an epoch proof, amortized over epoch duration and `manaTarget`, plus a
|
|
30
48
|
governance-set proving cost that compensates for off-chain proof generation:
|
|
31
49
|
|
|
32
50
|
```
|
|
33
|
-
proverCost = (L1_GAS_PER_EPOCH_VERIFIED * baseFee / epochDuration) / manaTarget
|
|
51
|
+
proverCost = ceil(ceil((L1_GAS_PER_EPOCH_VERIFIED * baseFee) / epochDuration) / manaTarget)
|
|
34
52
|
+ provingCostPerMana
|
|
35
53
|
```
|
|
36
54
|
|
|
55
|
+
Updates to `provingCostPerMana` are rate-limited on L1 (`FeeLib.updateProvingCostPerMana`):
|
|
56
|
+
at most one update every 30 days, each moving the value by at most ×1.5 (or ÷1.5), with a
|
|
57
|
+
floor of 2 wei per mana.
|
|
58
|
+
|
|
37
59
|
### Congestion Cost
|
|
38
60
|
|
|
39
61
|
An exponential surcharge when the network is congested (inspired by EIP-1559; the
|
|
40
62
|
implementation uses the `fakeExponential` Taylor series approximation from EIP-4844):
|
|
41
63
|
|
|
42
64
|
```
|
|
43
|
-
baseCost
|
|
44
|
-
congestionCost
|
|
65
|
+
baseCost = sequencerCost + proverCost
|
|
66
|
+
congestionCost = floor(baseCost * congestionMultiplier / MINIMUM_CONGESTION_MULTIPLIER) - baseCost
|
|
45
67
|
```
|
|
46
68
|
|
|
47
69
|
When there is no congestion the multiplier equals `MINIMUM_CONGESTION_MULTIPLIER` (1e9)
|
|
@@ -50,11 +72,15 @@ and congestion cost is zero.
|
|
|
50
72
|
### Congestion Multiplier
|
|
51
73
|
|
|
52
74
|
```
|
|
53
|
-
excessMana
|
|
54
|
-
|
|
75
|
+
excessMana = max(0, prevExcessMana + prevManaUsed - manaTarget)
|
|
76
|
+
denominator = manaTarget * 854,700,854 / 1e8 ≈ 8.547 * manaTarget
|
|
77
|
+
congestionMultiplier = fakeExponential(MINIMUM_CONGESTION_MULTIPLIER,
|
|
78
|
+
min(excessMana, 100 * denominator), denominator)
|
|
55
79
|
```
|
|
56
80
|
|
|
57
|
-
Each additional `manaTarget` of excess mana
|
|
81
|
+
Each additional `manaTarget` of excess mana multiplies the fee by `e^(1/8.547) ≈ 1.124`,
|
|
82
|
+
i.e. ~12.5%. The exponent is capped at 100 (multiplier ≤ ~2.7e43 × the minimum) to keep
|
|
83
|
+
the Taylor series from overflowing.
|
|
58
84
|
|
|
59
85
|
### Total
|
|
60
86
|
|
|
@@ -62,6 +88,11 @@ Each additional `manaTarget` of excess mana increases the multiplier by ~12.5%.
|
|
|
62
88
|
minFeePerMana = sequencerCost + proverCost + congestionCost
|
|
63
89
|
```
|
|
64
90
|
|
|
91
|
+
Each component is converted from ETH to the fee asset individually (rounding up) before
|
|
92
|
+
summing. The sum is capped at `type(uint128).max` (`FeeLib.summedMinFee`) so it always fits
|
|
93
|
+
the proposal header's `feePerL2Gas` field — without the cap, extreme congestion could
|
|
94
|
+
produce a fee no valid header can represent, halting the chain.
|
|
95
|
+
|
|
65
96
|
## L1 Gas Oracle: Lag and Lifetime
|
|
66
97
|
|
|
67
98
|
The oracle feeds Ethereum's `baseFee` and `blobFee` into the fee model using a two-phase
|
|
@@ -70,9 +101,9 @@ The oracle feeds Ethereum's `baseFee` and `blobFee` into the fee model using a t
|
|
|
70
101
|
- **LAG = 2 slots** — when new L1 fees are observed, they activate `LAG` slots later
|
|
71
102
|
(`slotOfChange = currentSlot + LAG`). This gives mempool transactions time to land
|
|
72
103
|
before fees change.
|
|
73
|
-
- **LIFETIME = 5 slots** — after an oracle update,
|
|
74
|
-
`slotOfChange + (LIFETIME - LAG)`
|
|
75
|
-
frequently L1 fee data can change.
|
|
104
|
+
- **LIFETIME = 5 slots** — after an oracle update, further updates are ignored
|
|
105
|
+
(`updateL1GasFeeOracle` returns without effect) until `slotOfChange + (LIFETIME - LAG)`
|
|
106
|
+
= 3 more slots have passed. This rate-limits how frequently L1 fee data can change.
|
|
76
107
|
|
|
77
108
|
Fee resolution at a given timestamp:
|
|
78
109
|
|
|
@@ -84,6 +115,12 @@ else → use post (new fees)
|
|
|
84
115
|
**Net effect**: L1 fee changes reach L2 with a 2-slot delay and can update at most once
|
|
85
116
|
every 5 slots.
|
|
86
117
|
|
|
118
|
+
Because queued values only activate `LAG` slots later, the min fee for the next `LAG`
|
|
119
|
+
slots is fully determined by current on-chain state. `fee_math.ts` ports the FeeLib
|
|
120
|
+
formulas so the sequencer can predict min fees over that window (`FeePredictor` in
|
|
121
|
+
`sequencer-client/src/global_variable_builder`), under a configurable mana-usage
|
|
122
|
+
assumption (`ManaUsageEstimate`: none / target / limit).
|
|
123
|
+
|
|
87
124
|
### Worked Example
|
|
88
125
|
|
|
89
126
|
Suppose the oracle is updated at slot 10 with new L1 fees. Here is the timeline:
|
|
@@ -117,34 +154,68 @@ Key observations:
|
|
|
117
154
|
|
|
118
155
|
## Fee Asset Price
|
|
119
156
|
|
|
120
|
-
Fees are computed in ETH internally
|
|
121
|
-
`ethPerFeeAsset` (1e12 precision)
|
|
122
|
-
|
|
157
|
+
Fees are computed in ETH (wei) internally and converted to the fee asset (Fee Juice) via
|
|
158
|
+
`ethPerFeeAsset` (1e12 precision), rounding up (`PriceLib.toFeeAsset` in
|
|
159
|
+
`l1-contracts/src/core/libraries/compressed-data/fees/FeeConfig.sol`).
|
|
160
|
+
|
|
161
|
+
Each checkpoint proposal carries a fee-asset price modifier (`OracleInput`) chosen by the
|
|
162
|
+
proposer, bounded to ±1% (±100 bps) per checkpoint:
|
|
123
163
|
|
|
124
164
|
```
|
|
125
165
|
newPrice = currentPrice * (10000 + modifierBps) / 10000
|
|
126
166
|
```
|
|
127
167
|
|
|
168
|
+
The result is clamped to [`MIN_ETH_PER_FEE_ASSET` = 100, `MAX_ETH_PER_FEE_ASSET` = 1e14],
|
|
169
|
+
i.e. 1e-10 to 100 ETH per fee asset. The floor of 100 guarantees a ±1% step always moves
|
|
170
|
+
the integer price by at least 1.
|
|
171
|
+
|
|
172
|
+
## Transaction Fees
|
|
173
|
+
|
|
174
|
+
The checkpoint's `gasFees` (the L1-computed min fee per mana, with DA priced at zero) act
|
|
175
|
+
as a base fee. Senders declare `GasSettings`: gas limits, teardown gas limits,
|
|
176
|
+
`maxFeesPerGas`, and `maxPriorityFeesPerGas`. A tx is only includable if `maxFeesPerGas`
|
|
177
|
+
covers the checkpoint's `gasFees` in both dimensions. The effective fee adds an
|
|
178
|
+
EIP-1559-style priority fee on top of the base, capped by the max
|
|
179
|
+
(`computeEffectiveGasFees` in `stdlib/src/fees/transaction_fee.ts`):
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
effectiveFeePerGas = gasFees + min(maxPriorityFeePerGas, maxFeesPerGas - gasFees) (per dimension)
|
|
183
|
+
transactionFee = billedGas.daGas * effectiveFeePerDaGas + billedGas.l2Gas * effectiveFeePerL2Gas
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
`billedGas` is actual consumption except for the teardown phase, which is billed at the
|
|
187
|
+
declared `teardownGasLimits` rather than actual usage — the fee is charged during teardown
|
|
188
|
+
itself, before actual teardown consumption is known.
|
|
189
|
+
|
|
128
190
|
## Maximum Fee Change Rate
|
|
129
191
|
|
|
130
|
-
| Component | Bound
|
|
131
|
-
| ---------------------- |
|
|
132
|
-
| L1 base fee / blob fee | At most once every 5 slots (oracle LIFETIME)
|
|
133
|
-
| Fee asset price | ±1% per checkpoint
|
|
192
|
+
| Component | Bound |
|
|
193
|
+
| ---------------------- | -------------------------------------------------------- |
|
|
194
|
+
| L1 base fee / blob fee | At most once every 5 slots (oracle LIFETIME) |
|
|
195
|
+
| Fee asset price | ±1% per checkpoint |
|
|
196
|
+
| Proving cost per mana | At most ×1.5 (or ÷1.5) per update, one update per 30 days |
|
|
134
197
|
| Congestion multiplier | Depends on excess mana accumulation/drain per checkpoint |
|
|
135
|
-
| Sequencer/prover costs | Scale linearly with L1 fees
|
|
198
|
+
| Sequencer/prover costs | Scale linearly with L1 fees |
|
|
136
199
|
|
|
137
200
|
## Key Constants
|
|
138
201
|
|
|
139
|
-
| Constant
|
|
140
|
-
|
|
|
141
|
-
| `L1_GAS_PER_CHECKPOINT_PROPOSED` | 300,000
|
|
142
|
-
| `L1_GAS_PER_EPOCH_VERIFIED` | 3,600,000
|
|
143
|
-
| `BLOBS_PER_CHECKPOINT`
|
|
144
|
-
| `BLOB_GAS_PER_BLOB` | 2^17
|
|
145
|
-
| `MINIMUM_CONGESTION_MULTIPLIER` | 1e9
|
|
146
|
-
| `LAG` | 2 slots
|
|
147
|
-
| `LIFETIME` | 5 slots
|
|
202
|
+
| Constant | Value |
|
|
203
|
+
| ------------------------------- | -------------- |
|
|
204
|
+
| `L1_GAS_PER_CHECKPOINT_PROPOSED` | 300,000 |
|
|
205
|
+
| `L1_GAS_PER_EPOCH_VERIFIED` | 3,600,000 |
|
|
206
|
+
| `BLOBS_PER_CHECKPOINT` (FeeLib) | 3 |
|
|
207
|
+
| `BLOB_GAS_PER_BLOB` | 2^17 |
|
|
208
|
+
| `MINIMUM_CONGESTION_MULTIPLIER` | 1e9 |
|
|
209
|
+
| `LAG` | 2 slots |
|
|
210
|
+
| `LIFETIME` | 5 slots |
|
|
211
|
+
| `MIN_ETH_PER_FEE_ASSET` | 100 (1e-10 ETH) |
|
|
212
|
+
| `MAX_ETH_PER_FEE_ASSET` | 1e14 (100 ETH) |
|
|
213
|
+
|
|
214
|
+
⚠️ Name clash: `FeeLib.sol` (and its port `fee_math.ts`) defines `BLOBS_PER_CHECKPOINT = 3`,
|
|
215
|
+
used only to price the sequencer's blob costs. The protocol constant of the same name in
|
|
216
|
+
`@aztec/constants` is **6** — the actual blob capacity of a checkpoint, used throughout the
|
|
217
|
+
limits section below. The FeeLib value is a holdover from the pre-checkpoint
|
|
218
|
+
`BLOBS_PER_BLOCK`, so the fee model prices half of a full checkpoint's blobs.
|
|
148
219
|
|
|
149
220
|
## Gas and Data Limits
|
|
150
221
|
|
|
@@ -196,7 +267,7 @@ advertises them in `NodeInfo.txsLimits` (a required field); wallets read it and
|
|
|
196
267
|
`GasSettings.fallback` as the default gas limits when sending without explicit limits, and they are enforced
|
|
197
268
|
by `GasLimitsValidator` (clamped to the per-tx protocol maxima) at three points: RPC tx acceptance
|
|
198
269
|
(`aztec-node/src/aztec-node/server.ts`), gossip validation (`p2p/src/services/libp2p/libp2p_service.ts`),
|
|
199
|
-
and pending-pool admission (`p2p/src/client/factory.ts`). They are deliberately *not* enforced at
|
|
270
|
+
and pending-pool admission (`p2p/src/client/factory.ts`). They are deliberately *not* enforced at req/resp or
|
|
200
271
|
block-proposal validation — admission is relay policy, not block validity.
|
|
201
272
|
|
|
202
273
|
### Per-block builder budgets
|
|
@@ -240,7 +311,8 @@ The outermost limits, enforced as proposal validity in `validateCheckpointLimits
|
|
|
240
311
|
|
|
241
312
|
## TypeScript Types
|
|
242
313
|
|
|
243
|
-
- **`Gas`** —
|
|
314
|
+
- **`Gas`** — gas quantity in two dimensions (`daGas`, `l2Gas`).
|
|
244
315
|
- **`GasFees`** — per-unit price in each dimension (`feePerDaGas`, `feePerL2Gas`).
|
|
245
316
|
- **`GasSettings`** — sender-chosen fee parameters: gas limits, teardown limits, max fees, priority fees.
|
|
246
317
|
- **`GasUsed`** — actual consumption after execution. Note: `billedGas` uses the teardown gas *limit*, not actual usage.
|
|
318
|
+
- **`fee_math.ts`** — TypeScript port of the FeeLib formulas, used for fee prediction over the oracle LAG window.
|
|
@@ -2,6 +2,7 @@ import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-ty
|
|
|
2
2
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
4
4
|
|
|
5
|
+
import type { BlockHash } from '../block/block_hash.js';
|
|
5
6
|
import type { L2Block } from '../block/l2_block.js';
|
|
6
7
|
import type { ChainConfig, SequencerConfig } from '../config/chain-config.js';
|
|
7
8
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
@@ -143,7 +144,11 @@ export interface ICheckpointBlockBuilder {
|
|
|
143
144
|
|
|
144
145
|
/** Interface for creating checkpoint builders. */
|
|
145
146
|
export interface ICheckpointsBuilder {
|
|
146
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Syncs world state to `blockNumber` and returns a fork of it at that block. When `blockHash` is
|
|
149
|
+
* provided it is verified against the synced block, triggering a resync on mismatch (reorg detection).
|
|
150
|
+
*/
|
|
151
|
+
getFork(blockNumber: BlockNumber, blockHash?: BlockHash): Promise<MerkleTreeWriteOperations>;
|
|
147
152
|
|
|
148
153
|
startCheckpoint(
|
|
149
154
|
checkpointNumber: CheckpointNumber,
|
|
@@ -9,7 +9,7 @@ import type { NullifierLeaf } from '../trees/nullifier_leaf.js';
|
|
|
9
9
|
import type { PublicDataTreeLeaf } from '../trees/public_data_leaf.js';
|
|
10
10
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
11
11
|
import type { StateReference } from '../tx/state_reference.js';
|
|
12
|
-
import type { WorldStateRevision
|
|
12
|
+
import type { WorldStateRevision } from '../world-state/world_state_revision.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Type alias for the nullifier tree ID.
|
|
@@ -138,7 +138,13 @@ export interface MerkleTreeReadOperations {
|
|
|
138
138
|
/**
|
|
139
139
|
* Gets the current revision.
|
|
140
140
|
*/
|
|
141
|
-
getRevision(): WorldStateRevision
|
|
141
|
+
getRevision(): WorldStateRevision;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Returns the IPC path of the underlying aztec-wsdb process. External AVM simulators use this to
|
|
145
|
+
* connect to the same world state instance that the TS layer is using.
|
|
146
|
+
*/
|
|
147
|
+
getIpcPath(): string;
|
|
142
148
|
|
|
143
149
|
/**
|
|
144
150
|
* Gets sibling path for a leaf.
|
|
@@ -5,9 +5,13 @@ import type {
|
|
|
5
5
|
PrivateKernelCircuitPublicInputs,
|
|
6
6
|
PrivateKernelInit2CircuitPrivateInputs,
|
|
7
7
|
PrivateKernelInit3CircuitPrivateInputs,
|
|
8
|
+
PrivateKernelInit4CircuitPrivateInputs,
|
|
9
|
+
PrivateKernelInit5CircuitPrivateInputs,
|
|
8
10
|
PrivateKernelInitCircuitPrivateInputs,
|
|
9
11
|
PrivateKernelInner2CircuitPrivateInputs,
|
|
10
12
|
PrivateKernelInner3CircuitPrivateInputs,
|
|
13
|
+
PrivateKernelInner4CircuitPrivateInputs,
|
|
14
|
+
PrivateKernelInner5CircuitPrivateInputs,
|
|
11
15
|
PrivateKernelInnerCircuitPrivateInputs,
|
|
12
16
|
PrivateKernelResetCircuitPrivateInputs,
|
|
13
17
|
PrivateKernelResetTailCircuitPrivateInputs,
|
|
@@ -83,6 +87,48 @@ export interface PrivateKernelProver {
|
|
|
83
87
|
privateKernelInputsInit3: PrivateKernelInit3CircuitPrivateInputs,
|
|
84
88
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
85
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Creates a proof output for a batched first iteration that processes four app calls in a single
|
|
92
|
+
* private kernel circuit.
|
|
93
|
+
*
|
|
94
|
+
* @param privateKernelInputsInit4 - The batched private data structure for the initial iteration.
|
|
95
|
+
* @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
|
|
96
|
+
*/
|
|
97
|
+
generateInit4Output(
|
|
98
|
+
privateKernelInputsInit4: PrivateKernelInit4CircuitPrivateInputs,
|
|
99
|
+
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Executes the batched first kernel iteration (four app calls) without generating a proof.
|
|
103
|
+
*
|
|
104
|
+
* @param privateKernelInputsInit4 - The batched private data structure for the initial iteration.
|
|
105
|
+
* @returns A Promise resolving to a ProofOutput object containing public inputs and an empty kernel proof.
|
|
106
|
+
*/
|
|
107
|
+
simulateInit4(
|
|
108
|
+
privateKernelInputsInit4: PrivateKernelInit4CircuitPrivateInputs,
|
|
109
|
+
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Creates a proof output for a batched first iteration that processes five app calls in a single
|
|
113
|
+
* private kernel circuit.
|
|
114
|
+
*
|
|
115
|
+
* @param privateKernelInputsInit5 - The batched private data structure for the initial iteration.
|
|
116
|
+
* @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
|
|
117
|
+
*/
|
|
118
|
+
generateInit5Output(
|
|
119
|
+
privateKernelInputsInit5: PrivateKernelInit5CircuitPrivateInputs,
|
|
120
|
+
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Executes the batched first kernel iteration (five app calls) without generating a proof.
|
|
124
|
+
*
|
|
125
|
+
* @param privateKernelInputsInit5 - The batched private data structure for the initial iteration.
|
|
126
|
+
* @returns A Promise resolving to a ProofOutput object containing public inputs and an empty kernel proof.
|
|
127
|
+
*/
|
|
128
|
+
simulateInit5(
|
|
129
|
+
privateKernelInputsInit5: PrivateKernelInit5CircuitPrivateInputs,
|
|
130
|
+
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
131
|
+
|
|
86
132
|
/**
|
|
87
133
|
* Creates a proof output for a given previous kernel data and private call data for an inner iteration.
|
|
88
134
|
*
|
|
@@ -145,6 +191,48 @@ export interface PrivateKernelProver {
|
|
|
145
191
|
privateKernelInputsInner3: PrivateKernelInner3CircuitPrivateInputs,
|
|
146
192
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
147
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Creates a proof output for a batched inner iteration that processes four app calls in a single
|
|
196
|
+
* private kernel circuit.
|
|
197
|
+
*
|
|
198
|
+
* @param privateKernelInputsInner4 - The batched private data structure for the inner iteration.
|
|
199
|
+
* @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
|
|
200
|
+
*/
|
|
201
|
+
generateInner4Output(
|
|
202
|
+
privateKernelInputsInner4: PrivateKernelInner4CircuitPrivateInputs,
|
|
203
|
+
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Executes the batched inner kernel iteration (four app calls) without generating a proof.
|
|
207
|
+
*
|
|
208
|
+
* @param privateKernelInputsInner4 - The batched private data structure for the inner iteration.
|
|
209
|
+
* @returns A Promise resolving to a ProofOutput object containing public inputs and an empty kernel proof.
|
|
210
|
+
*/
|
|
211
|
+
simulateInner4(
|
|
212
|
+
privateKernelInputsInner4: PrivateKernelInner4CircuitPrivateInputs,
|
|
213
|
+
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Creates a proof output for a batched inner iteration that processes five app calls in a single
|
|
217
|
+
* private kernel circuit.
|
|
218
|
+
*
|
|
219
|
+
* @param privateKernelInputsInner5 - The batched private data structure for the inner iteration.
|
|
220
|
+
* @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
|
|
221
|
+
*/
|
|
222
|
+
generateInner5Output(
|
|
223
|
+
privateKernelInputsInner5: PrivateKernelInner5CircuitPrivateInputs,
|
|
224
|
+
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Executes the batched inner kernel iteration (five app calls) without generating a proof.
|
|
228
|
+
*
|
|
229
|
+
* @param privateKernelInputsInner5 - The batched private data structure for the inner iteration.
|
|
230
|
+
* @returns A Promise resolving to a ProofOutput object containing public inputs and an empty kernel proof.
|
|
231
|
+
*/
|
|
232
|
+
simulateInner5(
|
|
233
|
+
privateKernelInputsInner5: PrivateKernelInner5CircuitPrivateInputs,
|
|
234
|
+
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
235
|
+
|
|
148
236
|
/**
|
|
149
237
|
* Creates a proof output by resetting the arrays using the reset circuit.
|
|
150
238
|
*
|
|
@@ -202,7 +290,12 @@ export interface PrivateKernelProver {
|
|
|
202
290
|
* Compute the gate count for a given circuit.
|
|
203
291
|
* @param bytecode - The circuit bytecode in gzipped bincode format
|
|
204
292
|
* @param circuitName - The name of the circuit
|
|
293
|
+
* @param circuitKind - The circuit kind expected by the Chonk backend
|
|
205
294
|
* @returns A Promise resolving to the gate count
|
|
206
295
|
*/
|
|
207
|
-
computeGateCountForCircuit(
|
|
296
|
+
computeGateCountForCircuit(
|
|
297
|
+
bytecode: Buffer,
|
|
298
|
+
circuitName: string,
|
|
299
|
+
circuitKind: PrivateExecutionStep['kind'],
|
|
300
|
+
): Promise<number>;
|
|
208
301
|
}
|
package/src/interfaces/server.ts
CHANGED
|
@@ -17,7 +17,6 @@ export * from './processed-tx-handler.js';
|
|
|
17
17
|
export * from './prover-agent.js';
|
|
18
18
|
export * from './prover-broker.js';
|
|
19
19
|
export * from './prover-client.js';
|
|
20
|
-
export * from './prover-coordination.js';
|
|
21
20
|
export * from './prover-node.js';
|
|
22
21
|
export * from './proving-job-source.js';
|
|
23
22
|
export * from './proving-job.js';
|
package/src/kernel/index.ts
CHANGED
|
@@ -9,9 +9,13 @@ export * from './private_kernel_data.js';
|
|
|
9
9
|
export * from './private_kernel_init_circuit_private_inputs.js';
|
|
10
10
|
export * from './private_kernel_init_2_circuit_private_inputs.js';
|
|
11
11
|
export * from './private_kernel_init_3_circuit_private_inputs.js';
|
|
12
|
+
export * from './private_kernel_init_4_circuit_private_inputs.js';
|
|
13
|
+
export * from './private_kernel_init_5_circuit_private_inputs.js';
|
|
12
14
|
export * from './private_kernel_inner_circuit_private_inputs.js';
|
|
13
15
|
export * from './private_kernel_inner_2_circuit_private_inputs.js';
|
|
14
16
|
export * from './private_kernel_inner_3_circuit_private_inputs.js';
|
|
17
|
+
export * from './private_kernel_inner_4_circuit_private_inputs.js';
|
|
18
|
+
export * from './private_kernel_inner_5_circuit_private_inputs.js';
|
|
15
19
|
export * from './private_kernel_reset_circuit_private_inputs.js';
|
|
16
20
|
export * from './private_kernel_reset_dimensions.js';
|
|
17
21
|
export * from './private_kernel_reset_tail_circuit_private_inputs.js';
|
|
@@ -46,10 +46,6 @@ export class PrivateKernelCircuitPublicInputs {
|
|
|
46
46
|
* Wether this is a private only tx or not
|
|
47
47
|
*/
|
|
48
48
|
public isPrivateOnly: boolean,
|
|
49
|
-
/**
|
|
50
|
-
* The nullifier that will be used for nonce generation
|
|
51
|
-
*/
|
|
52
|
-
public claimedFirstNullifier: Fr,
|
|
53
49
|
/**
|
|
54
50
|
* A claim to the final min revertible side effect counter of a tx.
|
|
55
51
|
*/
|
|
@@ -74,7 +70,6 @@ export class PrivateKernelCircuitPublicInputs {
|
|
|
74
70
|
this.feePayer,
|
|
75
71
|
bigintToUInt64BE(this.expirationTimestamp),
|
|
76
72
|
this.isPrivateOnly,
|
|
77
|
-
this.claimedFirstNullifier,
|
|
78
73
|
this.claimedRevertibleCounter,
|
|
79
74
|
);
|
|
80
75
|
}
|
|
@@ -95,7 +90,6 @@ export class PrivateKernelCircuitPublicInputs {
|
|
|
95
90
|
reader.readObject(AztecAddress),
|
|
96
91
|
reader.readUInt64(),
|
|
97
92
|
reader.readBoolean(),
|
|
98
|
-
reader.readObject(Fr),
|
|
99
93
|
reader.readNumber(),
|
|
100
94
|
);
|
|
101
95
|
}
|
|
@@ -110,7 +104,6 @@ export class PrivateKernelCircuitPublicInputs {
|
|
|
110
104
|
AztecAddress.ZERO,
|
|
111
105
|
0n,
|
|
112
106
|
false,
|
|
113
|
-
Fr.zero(),
|
|
114
107
|
0,
|
|
115
108
|
);
|
|
116
109
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
+
|
|
4
|
+
import { ProtocolContracts } from '../tx/protocol_contracts.js';
|
|
5
|
+
import { TxRequest } from '../tx/tx_request.js';
|
|
6
|
+
import { PrivateCallData } from './private_call_data.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Input to the batched private kernel init circuit, which processes the first four app calls of a
|
|
10
|
+
* transaction in a single iteration.
|
|
11
|
+
*/
|
|
12
|
+
export class PrivateKernelInit4CircuitPrivateInputs {
|
|
13
|
+
constructor(
|
|
14
|
+
public txRequest: TxRequest,
|
|
15
|
+
public vkTreeRoot: Fr,
|
|
16
|
+
public protocolContracts: ProtocolContracts,
|
|
17
|
+
public privateCall0: PrivateCallData,
|
|
18
|
+
public privateCall1: PrivateCallData,
|
|
19
|
+
public privateCall2: PrivateCallData,
|
|
20
|
+
public privateCall3: PrivateCallData,
|
|
21
|
+
public isPrivateOnly: boolean,
|
|
22
|
+
public revertibleCounterHint: number,
|
|
23
|
+
) {}
|
|
24
|
+
|
|
25
|
+
toBuffer() {
|
|
26
|
+
return serializeToBuffer(
|
|
27
|
+
this.txRequest,
|
|
28
|
+
this.vkTreeRoot,
|
|
29
|
+
this.protocolContracts,
|
|
30
|
+
this.privateCall0,
|
|
31
|
+
this.privateCall1,
|
|
32
|
+
this.privateCall2,
|
|
33
|
+
this.privateCall3,
|
|
34
|
+
this.revertibleCounterHint,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelInit4CircuitPrivateInputs {
|
|
39
|
+
const reader = BufferReader.asReader(buffer);
|
|
40
|
+
return new PrivateKernelInit4CircuitPrivateInputs(
|
|
41
|
+
reader.readObject(TxRequest),
|
|
42
|
+
Fr.fromBuffer(reader),
|
|
43
|
+
reader.readObject(ProtocolContracts),
|
|
44
|
+
reader.readObject(PrivateCallData),
|
|
45
|
+
reader.readObject(PrivateCallData),
|
|
46
|
+
reader.readObject(PrivateCallData),
|
|
47
|
+
reader.readObject(PrivateCallData),
|
|
48
|
+
reader.readBoolean(),
|
|
49
|
+
reader.readNumber(),
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
+
|
|
4
|
+
import { ProtocolContracts } from '../tx/protocol_contracts.js';
|
|
5
|
+
import { TxRequest } from '../tx/tx_request.js';
|
|
6
|
+
import { PrivateCallData } from './private_call_data.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Input to the batched private kernel init circuit, which processes the first five app calls of a
|
|
10
|
+
* transaction in a single iteration.
|
|
11
|
+
*/
|
|
12
|
+
export class PrivateKernelInit5CircuitPrivateInputs {
|
|
13
|
+
constructor(
|
|
14
|
+
public txRequest: TxRequest,
|
|
15
|
+
public vkTreeRoot: Fr,
|
|
16
|
+
public protocolContracts: ProtocolContracts,
|
|
17
|
+
public privateCall0: PrivateCallData,
|
|
18
|
+
public privateCall1: PrivateCallData,
|
|
19
|
+
public privateCall2: PrivateCallData,
|
|
20
|
+
public privateCall3: PrivateCallData,
|
|
21
|
+
public privateCall4: PrivateCallData,
|
|
22
|
+
public isPrivateOnly: boolean,
|
|
23
|
+
public revertibleCounterHint: number,
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
toBuffer() {
|
|
27
|
+
return serializeToBuffer(
|
|
28
|
+
this.txRequest,
|
|
29
|
+
this.vkTreeRoot,
|
|
30
|
+
this.protocolContracts,
|
|
31
|
+
this.privateCall0,
|
|
32
|
+
this.privateCall1,
|
|
33
|
+
this.privateCall2,
|
|
34
|
+
this.privateCall3,
|
|
35
|
+
this.privateCall4,
|
|
36
|
+
this.revertibleCounterHint,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelInit5CircuitPrivateInputs {
|
|
41
|
+
const reader = BufferReader.asReader(buffer);
|
|
42
|
+
return new PrivateKernelInit5CircuitPrivateInputs(
|
|
43
|
+
reader.readObject(TxRequest),
|
|
44
|
+
Fr.fromBuffer(reader),
|
|
45
|
+
reader.readObject(ProtocolContracts),
|
|
46
|
+
reader.readObject(PrivateCallData),
|
|
47
|
+
reader.readObject(PrivateCallData),
|
|
48
|
+
reader.readObject(PrivateCallData),
|
|
49
|
+
reader.readObject(PrivateCallData),
|
|
50
|
+
reader.readObject(PrivateCallData),
|
|
51
|
+
reader.readBoolean(),
|
|
52
|
+
reader.readNumber(),
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
2
|
+
|
|
3
|
+
import { PrivateCallData } from './private_call_data.js';
|
|
4
|
+
import { PrivateKernelData } from './private_kernel_data.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Input to the batched private kernel inner circuit, which processes four app calls in a single
|
|
8
|
+
* iteration following a previous kernel.
|
|
9
|
+
*/
|
|
10
|
+
export class PrivateKernelInner4CircuitPrivateInputs {
|
|
11
|
+
constructor(
|
|
12
|
+
public previousKernel: PrivateKernelData,
|
|
13
|
+
public privateCall0: PrivateCallData,
|
|
14
|
+
public privateCall1: PrivateCallData,
|
|
15
|
+
public privateCall2: PrivateCallData,
|
|
16
|
+
public privateCall3: PrivateCallData,
|
|
17
|
+
) {}
|
|
18
|
+
|
|
19
|
+
toBuffer() {
|
|
20
|
+
return serializeToBuffer(
|
|
21
|
+
this.previousKernel,
|
|
22
|
+
this.privateCall0,
|
|
23
|
+
this.privateCall1,
|
|
24
|
+
this.privateCall2,
|
|
25
|
+
this.privateCall3,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelInner4CircuitPrivateInputs {
|
|
30
|
+
const reader = BufferReader.asReader(buffer);
|
|
31
|
+
return new PrivateKernelInner4CircuitPrivateInputs(
|
|
32
|
+
reader.readObject(PrivateKernelData),
|
|
33
|
+
reader.readObject(PrivateCallData),
|
|
34
|
+
reader.readObject(PrivateCallData),
|
|
35
|
+
reader.readObject(PrivateCallData),
|
|
36
|
+
reader.readObject(PrivateCallData),
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
2
|
+
|
|
3
|
+
import { PrivateCallData } from './private_call_data.js';
|
|
4
|
+
import { PrivateKernelData } from './private_kernel_data.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Input to the batched private kernel inner circuit, which processes five app calls in a single
|
|
8
|
+
* iteration following a previous kernel.
|
|
9
|
+
*/
|
|
10
|
+
export class PrivateKernelInner5CircuitPrivateInputs {
|
|
11
|
+
constructor(
|
|
12
|
+
public previousKernel: PrivateKernelData,
|
|
13
|
+
public privateCall0: PrivateCallData,
|
|
14
|
+
public privateCall1: PrivateCallData,
|
|
15
|
+
public privateCall2: PrivateCallData,
|
|
16
|
+
public privateCall3: PrivateCallData,
|
|
17
|
+
public privateCall4: PrivateCallData,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
toBuffer() {
|
|
21
|
+
return serializeToBuffer(
|
|
22
|
+
this.previousKernel,
|
|
23
|
+
this.privateCall0,
|
|
24
|
+
this.privateCall1,
|
|
25
|
+
this.privateCall2,
|
|
26
|
+
this.privateCall3,
|
|
27
|
+
this.privateCall4,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelInner5CircuitPrivateInputs {
|
|
32
|
+
const reader = BufferReader.asReader(buffer);
|
|
33
|
+
return new PrivateKernelInner5CircuitPrivateInputs(
|
|
34
|
+
reader.readObject(PrivateKernelData),
|
|
35
|
+
reader.readObject(PrivateCallData),
|
|
36
|
+
reader.readObject(PrivateCallData),
|
|
37
|
+
reader.readObject(PrivateCallData),
|
|
38
|
+
reader.readObject(PrivateCallData),
|
|
39
|
+
reader.readObject(PrivateCallData),
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|