@aztec/sequencer-client 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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/client/index.d.ts +1 -1
- package/dest/client/sequencer-client.d.ts +10 -8
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +40 -28
- package/dest/config.d.ts +13 -5
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +82 -25
- package/dest/global_variable_builder/global_builder.d.ts +22 -16
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +52 -39
- package/dest/global_variable_builder/index.d.ts +1 -1
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/publisher/config.d.ts +11 -8
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +21 -13
- package/dest/publisher/index.d.ts +2 -2
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/index.js +1 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts +11 -5
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +9 -2
- package/dest/publisher/sequencer-publisher-metrics.d.ts +4 -4
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +1 -1
- package/dest/publisher/sequencer-publisher.d.ts +78 -70
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +687 -182
- package/dest/sequencer/block_builder.d.ts +6 -10
- package/dest/sequencer/block_builder.d.ts.map +1 -1
- package/dest/sequencer/block_builder.js +21 -10
- package/dest/sequencer/checkpoint_builder.d.ts +63 -0
- package/dest/sequencer/checkpoint_builder.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_builder.js +131 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +76 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +1070 -0
- package/dest/sequencer/checkpoint_voter.d.ts +34 -0
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_voter.js +85 -0
- package/dest/sequencer/config.d.ts +3 -2
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/errors.d.ts +11 -0
- package/dest/sequencer/errors.d.ts.map +1 -0
- package/dest/sequencer/errors.js +15 -0
- package/dest/sequencer/events.d.ts +46 -0
- package/dest/sequencer/events.d.ts.map +1 -0
- package/dest/sequencer/events.js +1 -0
- package/dest/sequencer/index.d.ts +5 -1
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +4 -0
- package/dest/sequencer/metrics.d.ts +37 -20
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +211 -85
- package/dest/sequencer/sequencer.d.ts +110 -121
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +809 -524
- package/dest/sequencer/timetable.d.ts +57 -21
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +150 -68
- package/dest/sequencer/types.d.ts +3 -0
- package/dest/sequencer/types.d.ts.map +1 -0
- package/dest/sequencer/types.js +1 -0
- package/dest/sequencer/utils.d.ts +20 -28
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +12 -24
- package/dest/test/index.d.ts +4 -2
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +83 -0
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
- package/dest/test/mock_checkpoint_builder.js +179 -0
- package/dest/test/utils.d.ts +49 -0
- package/dest/test/utils.d.ts.map +1 -0
- package/dest/test/utils.js +94 -0
- package/dest/tx_validator/nullifier_cache.d.ts +1 -1
- package/dest/tx_validator/nullifier_cache.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.d.ts +4 -3
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.js +12 -9
- package/package.json +32 -31
- package/src/client/sequencer-client.ts +34 -40
- package/src/config.ts +89 -29
- package/src/global_variable_builder/global_builder.ts +67 -59
- package/src/index.ts +2 -0
- package/src/publisher/config.ts +32 -19
- package/src/publisher/index.ts +1 -1
- package/src/publisher/sequencer-publisher-factory.ts +19 -6
- package/src/publisher/sequencer-publisher-metrics.ts +3 -3
- package/src/publisher/sequencer-publisher.ts +418 -242
- package/src/sequencer/README.md +531 -0
- package/src/sequencer/block_builder.ts +28 -30
- package/src/sequencer/checkpoint_builder.ts +217 -0
- package/src/sequencer/checkpoint_proposal_job.ts +722 -0
- package/src/sequencer/checkpoint_voter.ts +105 -0
- package/src/sequencer/config.ts +2 -1
- package/src/sequencer/errors.ts +21 -0
- package/src/sequencer/events.ts +27 -0
- package/src/sequencer/index.ts +4 -0
- package/src/sequencer/metrics.ts +269 -94
- package/src/sequencer/sequencer.ts +508 -675
- package/src/sequencer/timetable.ts +181 -91
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +24 -29
- package/src/test/index.ts +3 -1
- package/src/test/mock_checkpoint_builder.ts +247 -0
- package/src/test/utils.ts +137 -0
- package/src/tx_validator/tx_validator_factory.ts +13 -7
package/src/publisher/config.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type BlobClientConfig, blobClientConfigMapping } from '@aztec/blob-client/client/config';
|
|
2
|
+
import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
3
|
+
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from '@aztec/ethereum/l1-tx-utils/config';
|
|
2
4
|
import {
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '@aztec/
|
|
8
|
-
import { type ConfigMappingsType, SecretValue, getConfigFromMappings } from '@aztec/foundation/config';
|
|
5
|
+
type ConfigMappingsType,
|
|
6
|
+
SecretValue,
|
|
7
|
+
booleanConfigHelper,
|
|
8
|
+
getConfigFromMappings,
|
|
9
|
+
} from '@aztec/foundation/config';
|
|
9
10
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -27,11 +28,13 @@ export type TxSenderConfig = L1ReaderConfig & {
|
|
|
27
28
|
* Configuration of the L1Publisher.
|
|
28
29
|
*/
|
|
29
30
|
export type PublisherConfig = L1TxUtilsConfig &
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
BlobClientConfig & {
|
|
32
|
+
/** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
|
|
33
|
+
publisherAllowInvalidStates?: boolean;
|
|
34
|
+
/** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1 */
|
|
35
|
+
fishermanMode?: boolean;
|
|
36
|
+
/** Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only) */
|
|
37
|
+
publisherForwarderAddress?: EthAddress;
|
|
35
38
|
};
|
|
36
39
|
|
|
37
40
|
export const getTxSenderConfigMappings: (
|
|
@@ -43,7 +46,7 @@ export const getTxSenderConfigMappings: (
|
|
|
43
46
|
description: 'The private keys to be used by the publisher.',
|
|
44
47
|
parseEnv: (val: string) => val.split(',').map(key => new SecretValue(`0x${key.replace('0x', '')}`)),
|
|
45
48
|
defaultValue: [],
|
|
46
|
-
fallback: scope === 'PROVER' ?
|
|
49
|
+
fallback: [scope === 'PROVER' ? `PROVER_PUBLISHER_PRIVATE_KEY` : `SEQ_PUBLISHER_PRIVATE_KEY`],
|
|
47
50
|
},
|
|
48
51
|
publisherAddresses: {
|
|
49
52
|
env: scope === 'PROVER' ? `PROVER_PUBLISHER_ADDRESSES` : `SEQ_PUBLISHER_ADDRESSES`,
|
|
@@ -60,14 +63,24 @@ export function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSender
|
|
|
60
63
|
export const getPublisherConfigMappings: (
|
|
61
64
|
scope: 'PROVER' | 'SEQ',
|
|
62
65
|
) => ConfigMappingsType<PublisherConfig & L1TxUtilsConfig> = scope => ({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
publisherAllowInvalidStates: {
|
|
67
|
+
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
68
|
+
env: scope === `PROVER` ? `PROVER_PUBLISHER_ALLOW_INVALID_STATES` : `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
69
|
+
...booleanConfigHelper(true),
|
|
70
|
+
},
|
|
71
|
+
fishermanMode: {
|
|
72
|
+
env: 'FISHERMAN_MODE',
|
|
73
|
+
description:
|
|
74
|
+
'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
|
|
75
|
+
...booleanConfigHelper(false),
|
|
76
|
+
},
|
|
77
|
+
publisherForwarderAddress: {
|
|
78
|
+
env: scope === `PROVER` ? `PROVER_PUBLISHER_FORWARDER_ADDRESS` : `SEQ_PUBLISHER_FORWARDER_ADDRESS`,
|
|
79
|
+
description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
|
|
80
|
+
parseEnv: (val: string) => (val ? EthAddress.fromString(val) : undefined),
|
|
68
81
|
},
|
|
69
82
|
...l1TxUtilsConfigMappings,
|
|
70
|
-
...
|
|
83
|
+
...blobClientConfigMapping,
|
|
71
84
|
});
|
|
72
85
|
|
|
73
86
|
export function getPublisherConfigFromEnv(scope: 'PROVER' | 'SEQ'): PublisherConfig {
|
package/src/publisher/index.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
-
import type
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
3
|
+
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
3
4
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
4
|
-
import type { GovernanceProposerContract,
|
|
5
|
+
import type { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
5
6
|
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
7
|
+
import type { PublisherFilter, PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
8
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
6
9
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
7
10
|
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
8
11
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -10,7 +13,7 @@ import { NodeKeystoreAdapter } from '@aztec/validator-client';
|
|
|
10
13
|
|
|
11
14
|
import type { SequencerClientConfig } from '../config.js';
|
|
12
15
|
import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
13
|
-
import { SequencerPublisher } from './sequencer-publisher.js';
|
|
16
|
+
import { type Action, SequencerPublisher } from './sequencer-publisher.js';
|
|
14
17
|
|
|
15
18
|
export type AttestorPublisherPair = {
|
|
16
19
|
attestorAddress: EthAddress;
|
|
@@ -19,21 +22,29 @@ export type AttestorPublisherPair = {
|
|
|
19
22
|
|
|
20
23
|
export class SequencerPublisherFactory {
|
|
21
24
|
private publisherMetrics: SequencerPublisherMetrics;
|
|
25
|
+
|
|
26
|
+
/** Stores the last slot in which every action was carried out by a publisher */
|
|
27
|
+
private lastActions: Partial<Record<Action, SlotNumber>> = {};
|
|
28
|
+
|
|
29
|
+
private logger: Logger;
|
|
30
|
+
|
|
22
31
|
constructor(
|
|
23
32
|
private sequencerConfig: SequencerClientConfig,
|
|
24
33
|
private deps: {
|
|
25
34
|
telemetry: TelemetryClient;
|
|
26
35
|
publisherManager: PublisherManager<L1TxUtilsWithBlobs>;
|
|
27
|
-
|
|
36
|
+
blobClient: BlobClientInterface;
|
|
28
37
|
dateProvider: DateProvider;
|
|
29
38
|
epochCache: EpochCache;
|
|
30
39
|
rollupContract: RollupContract;
|
|
31
40
|
governanceProposerContract: GovernanceProposerContract;
|
|
32
41
|
slashFactoryContract: SlashFactoryContract;
|
|
33
42
|
nodeKeyStore: NodeKeystoreAdapter;
|
|
43
|
+
logger?: Logger;
|
|
34
44
|
},
|
|
35
45
|
) {
|
|
36
46
|
this.publisherMetrics = new SequencerPublisherMetrics(deps.telemetry, 'SequencerPublisher');
|
|
47
|
+
this.logger = deps.logger ?? createLogger('sequencer');
|
|
37
48
|
}
|
|
38
49
|
/**
|
|
39
50
|
* Creates a new SequencerPublisher instance.
|
|
@@ -61,7 +72,7 @@ export class SequencerPublisherFactory {
|
|
|
61
72
|
const publisher = new SequencerPublisher(this.sequencerConfig, {
|
|
62
73
|
l1TxUtils: l1Publisher,
|
|
63
74
|
telemetry: this.deps.telemetry,
|
|
64
|
-
|
|
75
|
+
blobClient: this.deps.blobClient,
|
|
65
76
|
rollupContract: this.deps.rollupContract,
|
|
66
77
|
epochCache: this.deps.epochCache,
|
|
67
78
|
governanceProposerContract: this.deps.governanceProposerContract,
|
|
@@ -69,6 +80,8 @@ export class SequencerPublisherFactory {
|
|
|
69
80
|
slashFactoryContract: this.deps.slashFactoryContract,
|
|
70
81
|
dateProvider: this.deps.dateProvider,
|
|
71
82
|
metrics: this.publisherMetrics,
|
|
83
|
+
lastActions: this.lastActions,
|
|
84
|
+
log: this.logger.createChild('publisher'),
|
|
72
85
|
});
|
|
73
86
|
|
|
74
87
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/aztec.js';
|
|
2
|
-
import type {
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
+
import type { L1PublishCheckpointStats, L1PublishStats } from '@aztec/stdlib/stats';
|
|
3
3
|
import {
|
|
4
4
|
Attributes,
|
|
5
5
|
type Gauge,
|
|
@@ -135,7 +135,7 @@ export class SequencerPublisherMetrics {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
recordProcessBlockTx(durationMs: number, stats:
|
|
138
|
+
recordProcessBlockTx(durationMs: number, stats: L1PublishCheckpointStats) {
|
|
139
139
|
this.recordTx('process', durationMs, stats);
|
|
140
140
|
|
|
141
141
|
if (stats.blobCount && stats.blobCount > 0) {
|