@aztec/aztec-node 5.3.0-nightly.20260909 → 5.3.0-nightly.20260911
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/aztec-node/next_block/index.d.ts +4 -0
- package/dest/aztec-node/next_block/index.d.ts.map +1 -0
- package/dest/aztec-node/next_block/index.js +3 -0
- package/dest/aztec-node/next_block/next_block_fee_cache.d.ts +110 -0
- package/dest/aztec-node/next_block/next_block_fee_cache.d.ts.map +1 -0
- package/dest/aztec-node/next_block/next_block_fee_cache.js +201 -0
- package/dest/aztec-node/next_block/next_block_planner.d.ts +78 -0
- package/dest/aztec-node/next_block/next_block_planner.d.ts.map +1 -0
- package/dest/aztec-node/next_block/next_block_planner.js +109 -0
- package/dest/aztec-node/next_block/next_block_predictor.d.ts +91 -0
- package/dest/aztec-node/next_block/next_block_predictor.d.ts.map +1 -0
- package/dest/aztec-node/next_block/next_block_predictor.js +146 -0
- package/dest/aztec-node/next_block/test_helpers.d.ts +40 -0
- package/dest/aztec-node/next_block/test_helpers.d.ts.map +1 -0
- package/dest/aztec-node/next_block/test_helpers.js +100 -0
- package/dest/aztec-node/node_public_calls_simulator.d.ts +10 -48
- package/dest/aztec-node/node_public_calls_simulator.d.ts.map +1 -1
- package/dest/aztec-node/node_public_calls_simulator.js +56 -164
- package/dest/aztec-node/server.d.ts +18 -2
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +34 -12
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +17 -1
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/package.json +28 -28
- package/src/aztec-node/next_block/index.ts +3 -0
- package/src/aztec-node/next_block/next_block_fee_cache.ts +279 -0
- package/src/aztec-node/next_block/next_block_planner.ts +198 -0
- package/src/aztec-node/next_block/next_block_predictor.ts +158 -0
- package/src/aztec-node/next_block/test_helpers.ts +115 -0
- package/src/aztec-node/node_public_calls_simulator.ts +78 -218
- package/src/aztec-node/server.ts +32 -9
- package/src/factory.ts +15 -1
- package/src/index.ts +1 -0
package/src/aztec-node/server.ts
CHANGED
|
@@ -114,6 +114,7 @@ import { NodeWorldStateQueries } from '../modules/node_world_state_queries.js';
|
|
|
114
114
|
import { UnseenBlockHoldOff } from '../modules/unseen_block_hold_off.js';
|
|
115
115
|
import { Sentinel } from '../sentinel/sentinel.js';
|
|
116
116
|
import type { AztecNodeConfig } from './config.js';
|
|
117
|
+
import { type NextBlockPredictor, QUOTE_MAX_WAIT_MS } from './next_block/index.js';
|
|
117
118
|
import { NodeMetrics } from './node_metrics.js';
|
|
118
119
|
import { NodePublicCallsSimulator } from './node_public_calls_simulator.js';
|
|
119
120
|
|
|
@@ -140,6 +141,7 @@ export interface AztecNodeServiceDeps {
|
|
|
140
141
|
globalVariableBuilder: GlobalVariableBuilderInterface;
|
|
141
142
|
rollupContract: RollupContract | undefined;
|
|
142
143
|
feeProvider: FeeProvider;
|
|
144
|
+
nextBlockPredictor: NextBlockPredictor;
|
|
143
145
|
epochCache: EpochCacheInterface;
|
|
144
146
|
packageVersion: string;
|
|
145
147
|
peerProofVerifier: ClientProtocolCircuitVerifier;
|
|
@@ -187,6 +189,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
|
|
|
187
189
|
protected readonly globalVariableBuilder: GlobalVariableBuilderInterface;
|
|
188
190
|
protected readonly rollupContract: RollupContract | undefined;
|
|
189
191
|
protected readonly feeProvider: FeeProvider;
|
|
192
|
+
protected readonly nextBlockPredictor: NextBlockPredictor;
|
|
190
193
|
protected readonly epochCache: EpochCacheInterface;
|
|
191
194
|
protected readonly packageVersion: string;
|
|
192
195
|
private peerProofVerifier: ClientProtocolCircuitVerifier;
|
|
@@ -217,6 +220,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
|
|
|
217
220
|
this.globalVariableBuilder = deps.globalVariableBuilder;
|
|
218
221
|
this.rollupContract = deps.rollupContract;
|
|
219
222
|
this.feeProvider = deps.feeProvider;
|
|
223
|
+
this.nextBlockPredictor = deps.nextBlockPredictor;
|
|
220
224
|
this.epochCache = deps.epochCache;
|
|
221
225
|
this.packageVersion = deps.packageVersion;
|
|
222
226
|
this.peerProofVerifier = deps.peerProofVerifier;
|
|
@@ -232,17 +236,11 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
|
|
|
232
236
|
this.metrics = new NodeMetrics(this.telemetry, 'AztecNodeService');
|
|
233
237
|
this.tracer = this.telemetry.getTracer('AztecNodeService');
|
|
234
238
|
|
|
235
|
-
// The node never represents a proposer's payout addresses, so the simulator zeroes coinbase and
|
|
236
|
-
// fee recipient. The signature context only needs chain id + rollup address (see signature_utils).
|
|
237
239
|
this.nodePublicCallsSimulator = new NodePublicCallsSimulator({
|
|
238
|
-
blockSource: this.blockSource,
|
|
239
240
|
worldStateSynchronizer: this.worldStateSynchronizer,
|
|
240
241
|
l1ToL2MessageSource: this.l1ToL2MessageSource,
|
|
241
242
|
contractDataSource: this.contractDataSource,
|
|
242
|
-
|
|
243
|
-
rollupContract: this.rollupContract,
|
|
244
|
-
epochCache: this.epochCache,
|
|
245
|
-
signatureContext: { chainId: this.l1ChainId, rollupAddress: this.config.rollupAddress },
|
|
243
|
+
predictor: this.nextBlockPredictor,
|
|
246
244
|
config: this.config,
|
|
247
245
|
telemetry: this.telemetry,
|
|
248
246
|
log: this.log.createChild('public-calls-simulator'),
|
|
@@ -463,9 +461,33 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
|
|
|
463
461
|
return await this.feeProvider.getCurrentMinFees();
|
|
464
462
|
}
|
|
465
463
|
|
|
466
|
-
/**
|
|
464
|
+
/**
|
|
465
|
+
* Returns the min fees a transaction submitted now may have to pay, worst entry first in intent: the list
|
|
466
|
+
* leads with the fee this node's public simulation would charge the next block right now, followed by the
|
|
467
|
+
* fee provider's projections for the current slot and the next N slots. Clients pad the worst entry, so a
|
|
468
|
+
* quoted transaction clears the simulation's fee check whether the difference comes from a frozen
|
|
469
|
+
* mid-checkpoint fee, a lagging clock, or L1 lag.
|
|
470
|
+
*
|
|
471
|
+
* The head normally comes from memory: the plan from the archiver's in-memory frontier and the boundary fee
|
|
472
|
+
* from the background-refreshed cache. At a boundary the cache has not priced yet, the request joins the
|
|
473
|
+
* shared refresh for at most {@link QUOTE_MAX_WAIT_MS}, a budget the projections' wait shares so the whole
|
|
474
|
+
* quote stays under that bound. The head is omitted when the node cannot produce it in time — an L1 outage
|
|
475
|
+
* that outlasts the cache's cutoff, or a frontier with no header for its proposed tip — in which case the
|
|
476
|
+
* projections alone are returned, as before this method grew a head.
|
|
477
|
+
*/
|
|
467
478
|
public async getPredictedMinFees(manaUsage?: ManaUsageEstimate): Promise<GasFees[]> {
|
|
468
|
-
|
|
479
|
+
const timer = new Timer();
|
|
480
|
+
const head = await this.nextBlockPredictor.quoteMinFees().catch((err: Error) => {
|
|
481
|
+
this.log.warn(`Failed to compute the next-block min fee for a quote, serving L1 projections only`, err);
|
|
482
|
+
return undefined;
|
|
483
|
+
});
|
|
484
|
+
// Tagging the projections with the head's L1 sync point keeps both halves of the answer on one L1 block.
|
|
485
|
+
const asOf = head?.l1SyncPoint && {
|
|
486
|
+
blockNumber: head.l1SyncPoint.blockNumber,
|
|
487
|
+
maxWaitMs: Math.max(0, QUOTE_MAX_WAIT_MS - timer.ms()),
|
|
488
|
+
};
|
|
489
|
+
const projections = await this.feeProvider.getPredictedMinFees(manaUsage, asOf);
|
|
490
|
+
return head ? [head.fees, ...projections] : projections;
|
|
469
491
|
}
|
|
470
492
|
|
|
471
493
|
public async getMaxPriorityFees(): Promise<GasFees> {
|
|
@@ -598,6 +620,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
|
|
|
598
620
|
await tryStop(this.automineSequencer);
|
|
599
621
|
await tryStop(this.proverNode);
|
|
600
622
|
await tryStop(this.p2pClient);
|
|
623
|
+
await tryStop(this.nextBlockPredictor);
|
|
601
624
|
await tryStop(this.feeProvider);
|
|
602
625
|
await tryStop(this.worldStateSynchronizer);
|
|
603
626
|
await tryStop(this.blockSource);
|
package/src/factory.ts
CHANGED
|
@@ -56,6 +56,7 @@ import { createWorldState, createWorldStateSynchronizer } from '@aztec/world-sta
|
|
|
56
56
|
import { createPublicClient } from 'viem';
|
|
57
57
|
|
|
58
58
|
import { type AztecNodeConfig, createKeyStoreForValidator } from './aztec-node/config.js';
|
|
59
|
+
import { NextBlockPredictor } from './aztec-node/next_block/index.js';
|
|
59
60
|
import { AztecNodeService } from './aztec-node/server.js';
|
|
60
61
|
import { createSentinel } from './sentinel/factory.js';
|
|
61
62
|
|
|
@@ -250,10 +251,22 @@ export async function createAztecNodeService(
|
|
|
250
251
|
};
|
|
251
252
|
|
|
252
253
|
const globalVariableBuilder = new GlobalVariableBuilder(publicClient, globalVariableBuilderConfig);
|
|
253
|
-
const feeProvider = new FeeProviderImpl(dateProvider, publicClient, globalVariableBuilderConfig);
|
|
254
|
+
const feeProvider = new FeeProviderImpl(dateProvider, publicClient, globalVariableBuilderConfig, archiver);
|
|
254
255
|
await feeProvider.start();
|
|
255
256
|
started.push(feeProvider);
|
|
256
257
|
|
|
258
|
+
const nextBlockPredictor = NextBlockPredictor.create({
|
|
259
|
+
blockSource: archiver,
|
|
260
|
+
globalVariableBuilder,
|
|
261
|
+
rollupContract,
|
|
262
|
+
epochCache,
|
|
263
|
+
signatureContext: { chainId: ethereumChain.chainInfo.id, rollupAddress: config.rollupAddress },
|
|
264
|
+
dateProvider,
|
|
265
|
+
log: log.createChild('next-block-predictor'),
|
|
266
|
+
});
|
|
267
|
+
nextBlockPredictor.start();
|
|
268
|
+
started.push(nextBlockPredictor);
|
|
269
|
+
|
|
257
270
|
const collectOffenses = !config.disableValidator || config.enableOffenseCollection;
|
|
258
271
|
|
|
259
272
|
// A prover node may still be proving an epoch whose blocks have already finalized on L1. Its proof
|
|
@@ -640,6 +653,7 @@ export async function createAztecNodeService(
|
|
|
640
653
|
globalVariableBuilder,
|
|
641
654
|
rollupContract,
|
|
642
655
|
feeProvider,
|
|
656
|
+
nextBlockPredictor,
|
|
643
657
|
epochCache,
|
|
644
658
|
packageVersion,
|
|
645
659
|
peerProofVerifier,
|
package/src/index.ts
CHANGED