@aztec/stdlib 5.0.0-nightly.20260410 → 5.0.0-nightly.20260412
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.d.ts +300 -300
- package/dest/config/sequencer-config.d.ts +2 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +7 -0
- package/dest/gas/fee_math.d.ts +49 -0
- package/dest/gas/fee_math.d.ts.map +1 -0
- package/dest/gas/fee_math.js +80 -0
- 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 +10 -1
- package/dest/gas/index.d.ts +2 -1
- package/dest/gas/index.d.ts.map +1 -1
- package/dest/gas/index.js +1 -0
- package/dest/interfaces/aztec-node-debug.d.ts +21 -0
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
- package/dest/interfaces/aztec-node-debug.js +18 -0
- package/dest/interfaces/aztec-node.d.ts +10 -1
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +2 -0
- package/dest/interfaces/client.d.ts +2 -1
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/client.js +1 -0
- package/dest/interfaces/proving-job.d.ts +166 -166
- package/dest/timetable/index.d.ts +50 -1
- package/dest/timetable/index.d.ts.map +1 -1
- package/dest/timetable/index.js +204 -18
- package/dest/tx/fee_provider.d.ts +10 -0
- package/dest/tx/fee_provider.d.ts.map +1 -0
- package/dest/tx/fee_provider.js +1 -0
- package/dest/tx/global_variable_builder.d.ts +3 -16
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/index.d.ts +2 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +1 -0
- package/dest/tx/simulated_tx.d.ts +1 -1
- package/dest/tx/simulated_tx.js +1 -1
- package/package.json +8 -8
- package/src/config/sequencer-config.ts +11 -1
- package/src/gas/README.md +31 -0
- package/src/gas/fee_math.ts +120 -0
- package/src/gas/gas_fees.ts +12 -4
- package/src/gas/index.ts +1 -0
- package/src/interfaces/aztec-node-debug.ts +40 -0
- package/src/interfaces/aztec-node.ts +15 -0
- package/src/interfaces/client.ts +1 -0
- package/src/timetable/index.ts +291 -16
- package/src/tx/fee_provider.ts +10 -0
- package/src/tx/global_variable_builder.ts +2 -18
- package/src/tx/index.ts +1 -0
- package/src/tx/simulated_tx.ts +1 -1
|
@@ -19,6 +19,55 @@ export declare const DEFAULT_P2P_PROPAGATION_TIME = 2;
|
|
|
19
19
|
export declare const DEFAULT_L1_PUBLISHING_TIME = 12;
|
|
20
20
|
/** Minimum execution time for building a block in seconds */
|
|
21
21
|
export declare const MIN_EXECUTION_TIME = 2;
|
|
22
|
+
export type CheckpointTimingConfig = {
|
|
23
|
+
aztecSlotDuration: number;
|
|
24
|
+
ethereumSlotDuration?: number;
|
|
25
|
+
blockDuration?: number;
|
|
26
|
+
checkpointAssembleTime?: number;
|
|
27
|
+
checkpointInitializationTime?: number;
|
|
28
|
+
l1PublishingTime?: number;
|
|
29
|
+
minExecutionTime?: number;
|
|
30
|
+
p2pPropagationTime?: number;
|
|
31
|
+
pipelining?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export interface CheckpointTiming {
|
|
34
|
+
readonly aztecSlotDuration: number;
|
|
35
|
+
readonly blockDuration: number | undefined;
|
|
36
|
+
readonly checkpointAssembleTime: number;
|
|
37
|
+
readonly checkpointInitializationTime: number;
|
|
38
|
+
readonly l1PublishingTime: number;
|
|
39
|
+
readonly minExecutionTime: number;
|
|
40
|
+
readonly p2pPropagationTime: number;
|
|
41
|
+
readonly checkpointFinalizationTime: number;
|
|
42
|
+
readonly pipeliningAttestationGracePeriod: number;
|
|
43
|
+
readonly timeReservedAtEnd: number;
|
|
44
|
+
readonly minimumBuildSlotWork: number;
|
|
45
|
+
readonly initializeDeadline: number;
|
|
46
|
+
readonly checkpointAssemblyDeadline: number;
|
|
47
|
+
readonly checkpointAttestationStartDeadline: number;
|
|
48
|
+
readonly checkpointAttestationDeadline: number;
|
|
49
|
+
readonly checkpointPublishingDeadline: number;
|
|
50
|
+
calculateMaxBlocksPerSlot(): number;
|
|
51
|
+
}
|
|
52
|
+
export interface PipelinedCheckpointTiming extends CheckpointTiming {
|
|
53
|
+
readonly proposalWindowIntoTargetSlot: number;
|
|
54
|
+
readonly attestationWindowIntoTargetSlot: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates a checkpoint timing model for the requested scheduling mode.
|
|
58
|
+
*
|
|
59
|
+
* Most callers should use this factory and depend only on the shared
|
|
60
|
+
* `CheckpointTiming` interface. The returned implementation is selected from
|
|
61
|
+
* `opts.pipelining`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function createCheckpointTimingModel(opts: CheckpointTimingConfig): CheckpointTiming;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a pipelined checkpoint timing model with target-slot window accessors.
|
|
66
|
+
*
|
|
67
|
+
* Use this when the caller specifically needs the pipelined-only timing surface,
|
|
68
|
+
* such as proposal or attestation acceptance windows into the target slot.
|
|
69
|
+
*/
|
|
70
|
+
export declare function createPipelinedCheckpointTimingModel(opts: Omit<CheckpointTimingConfig, 'pipelining'>): PipelinedCheckpointTiming;
|
|
22
71
|
/**
|
|
23
72
|
* Calculates the maximum number of blocks that can be built in a slot.
|
|
24
73
|
* Used by both the sequencer timetable and p2p gossipsub scoring.
|
|
@@ -35,4 +84,4 @@ export declare function calculateMaxBlocksPerSlot(aztecSlotDurationSec: number,
|
|
|
35
84
|
l1PublishingTime?: number;
|
|
36
85
|
pipelining?: boolean;
|
|
37
86
|
}): number;
|
|
38
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
87
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90aW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C,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;IAC5C,QAAQ,CAAC,kCAAkC,EAAE,MAAM,CAAC;IACpD,QAAQ,CAAC,6BAA6B,EAAE,MAAM,CAAC;IAC/C,QAAQ,CAAC,4BAA4B,EAAE,MAAM,CAAC;IAE9C,yBAAyB,IAAI,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IACjE,QAAQ,CAAC,4BAA4B,EAAE,MAAM,CAAC;IAC9C,QAAQ,CAAC,+BAA+B,EAAE,MAAM,CAAC;CAClD;AA8ID;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,sBAAsB,GAAG,gBAAgB,CAS1F;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,CAAC,GAC/C,yBAAyB,CAO3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,oBAAoB,EAAE,MAAM,EAC5B,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,IAAI,GAAE;IACJ,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACjB,GACL,MAAM,CAUR"}
|
package/dest/timetable/index.js
CHANGED
|
@@ -13,6 +13,139 @@
|
|
|
13
13
|
/** Default one-way P2P propagation time for proposals and attestations in seconds */ export const DEFAULT_P2P_PROPAGATION_TIME = 2;
|
|
14
14
|
/** Default L1 publishing time (matches Ethereum slot duration on mainnet) in seconds */ export const DEFAULT_L1_PUBLISHING_TIME = 12;
|
|
15
15
|
/** Minimum execution time for building a block in seconds */ export const MIN_EXECUTION_TIME = 2;
|
|
16
|
+
/**
|
|
17
|
+
* Shared base for checkpoint timing implementations.
|
|
18
|
+
*
|
|
19
|
+
* This class owns the common inputs and formulas used by both pipelined and
|
|
20
|
+
* non-pipelined scheduling. Variant-specific deadline math is delegated to the
|
|
21
|
+
* concrete subclasses below.
|
|
22
|
+
*/ class BaseCheckpointTiming {
|
|
23
|
+
aztecSlotDuration;
|
|
24
|
+
blockDuration;
|
|
25
|
+
checkpointAssembleTime;
|
|
26
|
+
checkpointInitializationTime;
|
|
27
|
+
l1PublishingTime;
|
|
28
|
+
minExecutionTime;
|
|
29
|
+
p2pPropagationTime;
|
|
30
|
+
constructor(opts){
|
|
31
|
+
this.aztecSlotDuration = opts.aztecSlotDuration;
|
|
32
|
+
this.blockDuration = opts.blockDuration;
|
|
33
|
+
this.checkpointAssembleTime = opts.checkpointAssembleTime ?? CHECKPOINT_ASSEMBLE_TIME;
|
|
34
|
+
this.checkpointInitializationTime = opts.checkpointInitializationTime ?? CHECKPOINT_INITIALIZATION_TIME;
|
|
35
|
+
this.l1PublishingTime = opts.l1PublishingTime ?? DEFAULT_L1_PUBLISHING_TIME;
|
|
36
|
+
this.minExecutionTime = opts.minExecutionTime ?? MIN_EXECUTION_TIME;
|
|
37
|
+
this.p2pPropagationTime = opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME;
|
|
38
|
+
}
|
|
39
|
+
get checkpointFinalizationTime() {
|
|
40
|
+
// Allow enough time to
|
|
41
|
+
// - build the checkpoint
|
|
42
|
+
// - Round-trip over p2p
|
|
43
|
+
// - Publish to L1
|
|
44
|
+
return this.checkpointAssembleTime + this.p2pPropagationTime * 2 + this.l1PublishingTime;
|
|
45
|
+
}
|
|
46
|
+
get pipeliningAttestationGracePeriod() {
|
|
47
|
+
// Allow enough time to
|
|
48
|
+
// - build the block
|
|
49
|
+
// - pass it back over p2p
|
|
50
|
+
return (this.blockDuration ?? 0) + this.p2pPropagationTime;
|
|
51
|
+
}
|
|
52
|
+
get initializeDeadline() {
|
|
53
|
+
return this.aztecSlotDuration - this.minimumBuildSlotWork;
|
|
54
|
+
}
|
|
55
|
+
get checkpointAttestationStartDeadline() {
|
|
56
|
+
return this.checkpointAssemblyDeadline;
|
|
57
|
+
}
|
|
58
|
+
calculateMaxBlocksPerSlot() {
|
|
59
|
+
if (!this.blockDuration) {
|
|
60
|
+
return 1;
|
|
61
|
+
}
|
|
62
|
+
const timeAvailableForBlocks = this.aztecSlotDuration - this.checkpointInitializationTime - this.timeReservedAtEnd;
|
|
63
|
+
return Math.floor(timeAvailableForBlocks / this.blockDuration);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checkpoint timing model for the non-pipelined sequencer flow.
|
|
68
|
+
*
|
|
69
|
+
* In this mode, checkpoint assembly, attestation collection, and L1 publishing
|
|
70
|
+
* must all complete within the current Aztec slot.
|
|
71
|
+
*/ class StandardCheckpointTimingModel extends BaseCheckpointTiming {
|
|
72
|
+
get timeReservedAtEnd() {
|
|
73
|
+
return (this.blockDuration ?? 0) + this.checkpointFinalizationTime;
|
|
74
|
+
}
|
|
75
|
+
get minimumBuildSlotWork() {
|
|
76
|
+
return this.checkpointInitializationTime + this.minExecutionTime * 2 + this.checkpointFinalizationTime;
|
|
77
|
+
}
|
|
78
|
+
get checkpointAssemblyDeadline() {
|
|
79
|
+
return this.aztecSlotDuration - this.l1PublishingTime - 2 * this.p2pPropagationTime;
|
|
80
|
+
}
|
|
81
|
+
get checkpointAttestationDeadline() {
|
|
82
|
+
return this.aztecSlotDuration - this.l1PublishingTime;
|
|
83
|
+
}
|
|
84
|
+
get checkpointPublishingDeadline() {
|
|
85
|
+
return this.aztecSlotDuration - this.l1PublishingTime;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Checkpoint timing model for proposer pipelining.
|
|
90
|
+
*
|
|
91
|
+
* In this mode, the build work still starts in the current slot, but checkpoint
|
|
92
|
+
* assembly and attestation collection can extend into the target slot. The extra
|
|
93
|
+
* target-slot window getters are intended for consumers such as P2P validators
|
|
94
|
+
* that need to validate pipelined messages against wallclock time.
|
|
95
|
+
*/ class PipelinedCheckpointTimingModel extends BaseCheckpointTiming {
|
|
96
|
+
get proposalWindowIntoTargetSlot() {
|
|
97
|
+
// Allow the p2p propagation time to receive a checkpoint proposal from leader
|
|
98
|
+
return this.p2pPropagationTime;
|
|
99
|
+
}
|
|
100
|
+
get attestationWindowIntoTargetSlot() {
|
|
101
|
+
return this.aztecSlotDuration - this.l1PublishingTime;
|
|
102
|
+
}
|
|
103
|
+
get timeReservedAtEnd() {
|
|
104
|
+
return this.checkpointAssembleTime + this.p2pPropagationTime;
|
|
105
|
+
}
|
|
106
|
+
get minimumBuildSlotWork() {
|
|
107
|
+
return this.checkpointInitializationTime + this.minExecutionTime * 2;
|
|
108
|
+
}
|
|
109
|
+
get checkpointAssemblyDeadline() {
|
|
110
|
+
// Allow enough time to
|
|
111
|
+
// - build all blocks
|
|
112
|
+
// - receive attestations
|
|
113
|
+
return this.aztecSlotDuration + this.pipeliningAttestationGracePeriod;
|
|
114
|
+
}
|
|
115
|
+
get checkpointAttestationDeadline() {
|
|
116
|
+
// Allowed to be into the next wallclock slot minus the allocated l1 publishing time
|
|
117
|
+
return this.aztecSlotDuration * 2 - this.l1PublishingTime;
|
|
118
|
+
}
|
|
119
|
+
get checkpointPublishingDeadline() {
|
|
120
|
+
// Allowed to be into the next wallclock slot minus the allocated l1 Publishing time
|
|
121
|
+
return this.aztecSlotDuration * 2 - this.l1PublishingTime;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Creates a checkpoint timing model for the requested scheduling mode.
|
|
126
|
+
*
|
|
127
|
+
* Most callers should use this factory and depend only on the shared
|
|
128
|
+
* `CheckpointTiming` interface. The returned implementation is selected from
|
|
129
|
+
* `opts.pipelining`.
|
|
130
|
+
*/ export function createCheckpointTimingModel(opts) {
|
|
131
|
+
validateCheckpointTimingConfig(opts);
|
|
132
|
+
const normalizedOpts = normalizeCheckpointTimingConfig(opts);
|
|
133
|
+
const timing = normalizedOpts.pipelining ? new PipelinedCheckpointTimingModel(normalizedOpts) : new StandardCheckpointTimingModel(normalizedOpts);
|
|
134
|
+
validateCheckpointTimingModel(timing);
|
|
135
|
+
return timing;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Creates a pipelined checkpoint timing model with target-slot window accessors.
|
|
139
|
+
*
|
|
140
|
+
* Use this when the caller specifically needs the pipelined-only timing surface,
|
|
141
|
+
* such as proposal or attestation acceptance windows into the target slot.
|
|
142
|
+
*/ export function createPipelinedCheckpointTimingModel(opts) {
|
|
143
|
+
validateCheckpointTimingConfig(opts);
|
|
144
|
+
const normalizedOpts = normalizeCheckpointTimingConfig(opts);
|
|
145
|
+
const timing = new PipelinedCheckpointTimingModel(normalizedOpts);
|
|
146
|
+
validateCheckpointTimingModel(timing);
|
|
147
|
+
return timing;
|
|
148
|
+
}
|
|
16
149
|
/**
|
|
17
150
|
* Calculates the maximum number of blocks that can be built in a slot.
|
|
18
151
|
* Used by both the sequencer timetable and p2p gossipsub scoring.
|
|
@@ -22,22 +155,75 @@
|
|
|
22
155
|
* @param opts - Optional overrides for timing constants
|
|
23
156
|
* @returns Maximum number of blocks per slot
|
|
24
157
|
*/ export function calculateMaxBlocksPerSlot(aztecSlotDurationSec, blockDurationSec, opts = {}) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
158
|
+
return createCheckpointTimingModel({
|
|
159
|
+
aztecSlotDuration: aztecSlotDurationSec,
|
|
160
|
+
blockDuration: blockDurationSec,
|
|
161
|
+
checkpointAssembleTime: opts.checkpointAssembleTime,
|
|
162
|
+
checkpointInitializationTime: opts.checkpointInitializationTime,
|
|
163
|
+
l1PublishingTime: opts.l1PublishingTime,
|
|
164
|
+
p2pPropagationTime: opts.p2pPropagationTime,
|
|
165
|
+
pipelining: opts.pipelining
|
|
166
|
+
}).calculateMaxBlocksPerSlot();
|
|
167
|
+
}
|
|
168
|
+
function assertNonNegative(name, value) {
|
|
169
|
+
if (value < 0) {
|
|
170
|
+
throw new Error(`${name} must be non-negative (got ${value})`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function validateCheckpointTimingConfig(opts) {
|
|
174
|
+
if (opts.aztecSlotDuration <= 0) {
|
|
175
|
+
throw new Error(`aztecSlotDuration must be positive (got ${opts.aztecSlotDuration})`);
|
|
176
|
+
}
|
|
177
|
+
if (opts.ethereumSlotDuration !== undefined && opts.ethereumSlotDuration <= 0) {
|
|
178
|
+
throw new Error(`ethereumSlotDuration must be positive when provided (got ${opts.ethereumSlotDuration})`);
|
|
179
|
+
}
|
|
180
|
+
if (opts.blockDuration !== undefined && opts.blockDuration <= 0) {
|
|
181
|
+
throw new Error(`blockDuration must be positive when provided (got ${opts.blockDuration})`);
|
|
182
|
+
}
|
|
183
|
+
if (opts.minExecutionTime !== undefined && opts.minExecutionTime <= 0) {
|
|
184
|
+
throw new Error(`minExecutionTime must be positive when provided (got ${opts.minExecutionTime})`);
|
|
185
|
+
}
|
|
186
|
+
if (opts.checkpointAssembleTime !== undefined) {
|
|
187
|
+
assertNonNegative('checkpointAssembleTime', opts.checkpointAssembleTime);
|
|
188
|
+
}
|
|
189
|
+
if (opts.checkpointInitializationTime !== undefined) {
|
|
190
|
+
assertNonNegative('checkpointInitializationTime', opts.checkpointInitializationTime);
|
|
191
|
+
}
|
|
192
|
+
if (opts.l1PublishingTime !== undefined) {
|
|
193
|
+
assertNonNegative('l1PublishingTime', opts.l1PublishingTime);
|
|
194
|
+
}
|
|
195
|
+
if (opts.p2pPropagationTime !== undefined) {
|
|
196
|
+
assertNonNegative('p2pPropagationTime', opts.p2pPropagationTime);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function normalizeCheckpointTimingConfig(opts) {
|
|
200
|
+
let checkpointAssembleTime = opts.checkpointAssembleTime ?? CHECKPOINT_ASSEMBLE_TIME;
|
|
201
|
+
let checkpointInitializationTime = opts.checkpointInitializationTime ?? CHECKPOINT_INITIALIZATION_TIME;
|
|
202
|
+
let minExecutionTime = opts.minExecutionTime ?? MIN_EXECUTION_TIME;
|
|
203
|
+
let p2pPropagationTime = opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME;
|
|
204
|
+
if (opts.ethereumSlotDuration !== undefined && opts.ethereumSlotDuration < 8) {
|
|
205
|
+
p2pPropagationTime = 0;
|
|
206
|
+
checkpointAssembleTime = 0.5;
|
|
207
|
+
checkpointInitializationTime = 0.5;
|
|
208
|
+
minExecutionTime = 1;
|
|
209
|
+
}
|
|
210
|
+
if (opts.blockDuration !== undefined && minExecutionTime > opts.blockDuration) {
|
|
211
|
+
minExecutionTime = opts.blockDuration;
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
...opts,
|
|
215
|
+
checkpointAssembleTime,
|
|
216
|
+
checkpointInitializationTime,
|
|
217
|
+
minExecutionTime,
|
|
218
|
+
p2pPropagationTime
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function validateCheckpointTimingModel(model) {
|
|
222
|
+
if (model.blockDuration === undefined) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const timeAvailableForBlocks = model.aztecSlotDuration - model.checkpointInitializationTime - model.timeReservedAtEnd;
|
|
226
|
+
if (timeAvailableForBlocks < model.blockDuration) {
|
|
227
|
+
throw new Error(`Invalid timing configuration: only ${timeAvailableForBlocks}s available for block building, which is less than one blockDuration (${model.blockDuration}s).`);
|
|
228
|
+
}
|
|
43
229
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ManaUsageEstimate } from '../gas/fee_math.js';
|
|
2
|
+
import type { GasFees } from '../gas/gas_fees.js';
|
|
3
|
+
/** Provides current and predicted fee information for transaction pricing. */
|
|
4
|
+
export interface FeeProvider {
|
|
5
|
+
/** Returns the current minimum fees for inclusion in the next block. */
|
|
6
|
+
getCurrentMinFees(): Promise<GasFees>;
|
|
7
|
+
/** Returns predicted min fees for each slot in the prediction window. */
|
|
8
|
+
getPredictedMinFees(manaUsage?: ManaUsageEstimate): Promise<GasFees[]>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmVlX3Byb3ZpZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHgvZmVlX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDNUQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFbEQsOEVBQThFO0FBQzlFLE1BQU0sV0FBVyxXQUFXO0lBQzFCLHdFQUF3RTtJQUN4RSxpQkFBaUIsSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDdEMseUVBQXlFO0lBQ3pFLG1CQUFtQixDQUFDLFNBQVMsQ0FBQyxFQUFFLGlCQUFpQixHQUFHLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUFDO0NBQ3hFIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fee_provider.d.ts","sourceRoot":"","sources":["../../src/tx/fee_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,yEAAyE;IACzE,mBAAmB,CAAC,SAAS,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;CACxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/** Provides current and predicted fee information for transaction pricing. */ export { };
|
|
@@ -1,26 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import type { SimulationOverridesPlan } from '@aztec/ethereum/contracts';
|
|
3
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
3
|
import type { SlotNumber } from '@aztec/foundation/schemas';
|
|
5
4
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
6
|
-
import type { GasFees } from '../gas/gas_fees.js';
|
|
7
5
|
import type { UInt32 } from '../types/index.js';
|
|
8
6
|
import type { CheckpointGlobalVariables, GlobalVariables } from './global_variables.js';
|
|
9
|
-
/** Fee header fields needed for pipelining overrides. */
|
|
10
|
-
export type ForceProposedFeeHeader = {
|
|
11
|
-
checkpointNumber: CheckpointNumber;
|
|
12
|
-
feeHeader: FeeHeader;
|
|
13
|
-
};
|
|
14
|
-
/** Options for building checkpoint global variables during pipelining. */
|
|
15
|
-
export type BuildCheckpointGlobalVariablesOpts = {
|
|
16
|
-
forcePendingCheckpointNumber?: CheckpointNumber;
|
|
17
|
-
forceProposedFeeHeader?: ForceProposedFeeHeader;
|
|
18
|
-
};
|
|
19
7
|
/**
|
|
20
8
|
* Interface for building global variables for Aztec blocks.
|
|
21
9
|
*/
|
|
22
10
|
export interface GlobalVariableBuilder {
|
|
23
|
-
getCurrentMinFees(): Promise<GasFees>;
|
|
24
11
|
/**
|
|
25
12
|
* Builds global variables for a given block.
|
|
26
13
|
* @param blockNumber - The block number to build global variables for.
|
|
@@ -31,6 +18,6 @@ export interface GlobalVariableBuilder {
|
|
|
31
18
|
*/
|
|
32
19
|
buildGlobalVariables(blockNumber: UInt32, coinbase: EthAddress, feeRecipient: AztecAddress, slotNumber?: SlotNumber): Promise<GlobalVariables>;
|
|
33
20
|
/** Builds global variables that are constant throughout a checkpoint. */
|
|
34
|
-
buildCheckpointGlobalVariables(coinbase: EthAddress, feeRecipient: AztecAddress, slotNumber: SlotNumber,
|
|
21
|
+
buildCheckpointGlobalVariables(coinbase: EthAddress, feeRecipient: AztecAddress, slotNumber: SlotNumber, simulationOverridesPlan?: SimulationOverridesPlan): Promise<CheckpointGlobalVariables>;
|
|
35
22
|
}
|
|
36
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2xvYmFsX3ZhcmlhYmxlX2J1aWxkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eC9nbG9iYWxfdmFyaWFibGVfYnVpbGRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSx1QkFBdUIsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3pFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBRTVELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ2hELE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLGVBQWUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXhGOztHQUVHO0FBQ0gsTUFBTSxXQUFXLHFCQUFxQjtJQUNwQzs7Ozs7OztPQU9HO0lBQ0gsb0JBQW9CLENBQ2xCLFdBQVcsRUFBRSxNQUFNLEVBQ25CLFFBQVEsRUFBRSxVQUFVLEVBQ3BCLFlBQVksRUFBRSxZQUFZLEVBQzFCLFVBQVUsQ0FBQyxFQUFFLFVBQVUsR0FDdEIsT0FBTyxDQUFDLGVBQWUsQ0FBQyxDQUFDO0lBRTVCLHlFQUF5RTtJQUN6RSw4QkFBOEIsQ0FDNUIsUUFBUSxFQUFFLFVBQVUsRUFDcEIsWUFBWSxFQUFFLFlBQVksRUFDMUIsVUFBVSxFQUFFLFVBQVUsRUFDdEIsdUJBQXVCLENBQUMsRUFBRSx1QkFBdUIsR0FDaEQsT0FBTyxDQUFDLHlCQUF5QixDQUFDLENBQUM7Q0FDdkMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global_variable_builder.d.ts","sourceRoot":"","sources":["../../src/tx/global_variable_builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"global_variable_builder.d.ts","sourceRoot":"","sources":["../../src/tx/global_variable_builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;OAOG;IACH,oBAAoB,CAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,eAAe,CAAC,CAAC;IAE5B,yEAAyE;IACzE,8BAA8B,CAC5B,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,uBAAuB,CAAC,EAAE,uBAAuB,GAChD,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACvC"}
|
package/dest/tx/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from './validator/tx_validator.js';
|
|
|
24
24
|
export * from './validator/empty_validator.js';
|
|
25
25
|
export * from './validator/error_texts.js';
|
|
26
26
|
export * from './capsule.js';
|
|
27
|
+
export * from './fee_provider.js';
|
|
27
28
|
export * from './global_variable_builder.js';
|
|
28
29
|
export * from './hashed_values.js';
|
|
29
30
|
export * from './indexed_tx_effect.js';
|
|
@@ -32,4 +33,4 @@ export * from './profiling.js';
|
|
|
32
33
|
export * from './protocol_contracts.js';
|
|
33
34
|
export * from './execution_payload.js';
|
|
34
35
|
export * from './in_tx.js';
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
36
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMsOEJBQThCLENBQUM7QUFDN0MsY0FBYyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMsK0JBQSt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AAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC"}
|
package/dest/tx/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export * from './validator/tx_validator.js';
|
|
|
24
24
|
export * from './validator/empty_validator.js';
|
|
25
25
|
export * from './validator/error_texts.js';
|
|
26
26
|
export * from './capsule.js';
|
|
27
|
+
export * from './fee_provider.js';
|
|
27
28
|
export * from './global_variable_builder.js';
|
|
28
29
|
export * from './hashed_values.js';
|
|
29
30
|
export * from './indexed_tx_effect.js';
|
|
@@ -1322,7 +1322,7 @@ export declare class TxSimulationResult {
|
|
|
1322
1322
|
getPublicReturnValues(): NestedProcessReturnValues[];
|
|
1323
1323
|
}
|
|
1324
1324
|
/**
|
|
1325
|
-
* Recursively
|
|
1325
|
+
* Recursively accumulate the return values of a call result and its nested executions,
|
|
1326
1326
|
* so they can be retrieved in order.
|
|
1327
1327
|
* @param executionResult
|
|
1328
1328
|
* @returns
|
package/dest/tx/simulated_tx.js
CHANGED
|
@@ -98,7 +98,7 @@ export class TxSimulationResult {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* Recursively
|
|
101
|
+
* Recursively accumulate the return values of a call result and its nested executions,
|
|
102
102
|
* so they can be retrieved in order.
|
|
103
103
|
* @param executionResult
|
|
104
104
|
* @returns
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "5.0.0-nightly.
|
|
3
|
+
"version": "5.0.0-nightly.20260412",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -92,13 +92,13 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
95
|
-
"@aztec/bb.js": "5.0.0-nightly.
|
|
96
|
-
"@aztec/blob-lib": "5.0.0-nightly.
|
|
97
|
-
"@aztec/constants": "5.0.0-nightly.
|
|
98
|
-
"@aztec/ethereum": "5.0.0-nightly.
|
|
99
|
-
"@aztec/foundation": "5.0.0-nightly.
|
|
100
|
-
"@aztec/l1-artifacts": "5.0.0-nightly.
|
|
101
|
-
"@aztec/noir-noirc_abi": "5.0.0-nightly.
|
|
95
|
+
"@aztec/bb.js": "5.0.0-nightly.20260412",
|
|
96
|
+
"@aztec/blob-lib": "5.0.0-nightly.20260412",
|
|
97
|
+
"@aztec/constants": "5.0.0-nightly.20260412",
|
|
98
|
+
"@aztec/ethereum": "5.0.0-nightly.20260412",
|
|
99
|
+
"@aztec/foundation": "5.0.0-nightly.20260412",
|
|
100
|
+
"@aztec/l1-artifacts": "5.0.0-nightly.20260412",
|
|
101
|
+
"@aztec/noir-noirc_abi": "5.0.0-nightly.20260412",
|
|
102
102
|
"@google-cloud/storage": "^7.15.0",
|
|
103
103
|
"axios": "^1.13.5",
|
|
104
104
|
"json-stringify-deterministic": "1.0.12",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ConfigMappingsType } from '@aztec/foundation/config';
|
|
2
2
|
|
|
3
3
|
import type { SequencerConfig } from '../interfaces/configs.js';
|
|
4
|
+
import { DEFAULT_P2P_PROPAGATION_TIME } from '../timetable/index.js';
|
|
4
5
|
|
|
5
6
|
/** Default maximum number of transactions per block. */
|
|
6
7
|
export const DEFAULT_MAX_TXS_PER_BLOCK = 32;
|
|
@@ -12,7 +13,10 @@ export const DEFAULT_MAX_TXS_PER_BLOCK = 32;
|
|
|
12
13
|
* to avoid duplication.
|
|
13
14
|
*/
|
|
14
15
|
export const sharedSequencerConfigMappings: ConfigMappingsType<
|
|
15
|
-
Pick<
|
|
16
|
+
Pick<
|
|
17
|
+
SequencerConfig,
|
|
18
|
+
'blockDurationMs' | 'expectedBlockProposalsPerSlot' | 'maxTxsPerBlock' | 'attestationPropagationTime'
|
|
19
|
+
>
|
|
16
20
|
> = {
|
|
17
21
|
blockDurationMs: {
|
|
18
22
|
env: 'SEQ_BLOCK_DURATION_MS',
|
|
@@ -34,4 +38,10 @@ export const sharedSequencerConfigMappings: ConfigMappingsType<
|
|
|
34
38
|
description: 'The maximum number of txs to include in a block.',
|
|
35
39
|
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
36
40
|
},
|
|
41
|
+
attestationPropagationTime: {
|
|
42
|
+
env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
|
|
43
|
+
description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way).',
|
|
44
|
+
parseEnv: (val: string) => (val ? parseFloat(val) : undefined),
|
|
45
|
+
defaultValue: DEFAULT_P2P_PROPAGATION_TIME,
|
|
46
|
+
},
|
|
37
47
|
};
|
package/src/gas/README.md
CHANGED
|
@@ -84,6 +84,37 @@ else → use post (new fees)
|
|
|
84
84
|
**Net effect**: L1 fee changes reach L2 with a 2-slot delay and can update at most once
|
|
85
85
|
every 5 slots.
|
|
86
86
|
|
|
87
|
+
### Worked Example
|
|
88
|
+
|
|
89
|
+
Suppose the oracle is updated at slot 10 with new L1 fees. Here is the timeline:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Slot Oracle state Active fees Notes
|
|
93
|
+
──── ──────────────────── ──────────── ──────────────────────────────────
|
|
94
|
+
10 pre=A, post=B, soc=12 A Update queued. slotOfChange = 10 + LAG = 12.
|
|
95
|
+
11 (same) A Still before slotOfChange → pre (A).
|
|
96
|
+
12 (same) B slot >= slotOfChange → post (B) activates.
|
|
97
|
+
13 (same) B B remains active.
|
|
98
|
+
14 (same) B B remains active.
|
|
99
|
+
15 Update allowed again B Earliest next update: soc + (LIFETIME - LAG)
|
|
100
|
+
= 12 + 3 = 15.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Key observations:
|
|
104
|
+
|
|
105
|
+
1. **Slots 10-11**: The old fees (A) are still in effect. Transactions submitted during
|
|
106
|
+
these slots see the old L1 cost. This is the **LAG** window — it gives pending
|
|
107
|
+
transactions 2 slots to land before fees change.
|
|
108
|
+
|
|
109
|
+
2. **Slot 12**: The new fees (B) activate. Any checkpoint proposed at slot >= 12 uses B
|
|
110
|
+
for its sequencer/prover cost calculation.
|
|
111
|
+
|
|
112
|
+
3. **Slots 12-14**: No new oracle update is accepted. The system is in a **cooldown**
|
|
113
|
+
period of `LIFETIME - LAG = 3` slots after the transition.
|
|
114
|
+
|
|
115
|
+
4. **Slot 15**: A new oracle update can be queued (earliest `acceptableSlot`). If
|
|
116
|
+
triggered, the new values would activate at slot 15 + LAG = 17.
|
|
117
|
+
|
|
87
118
|
## Fee Asset Price
|
|
88
119
|
|
|
89
120
|
Fees are computed in ETH internally but converted to the fee asset (Fee Juice) via
|