@aztec/sequencer-client 0.0.1-commit.88e6f9396 → 0.0.1-commit.8c0b8ff
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/sequencer-client.d.ts +5 -1
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +6 -12
- package/dest/config.d.ts +3 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +1 -2
- package/dest/global_variable_builder/global_builder.d.ts +13 -7
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +22 -22
- package/dest/global_variable_builder/index.d.ts +2 -2
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/publisher/config.d.ts +1 -5
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +1 -6
- package/dest/publisher/index.d.ts +1 -2
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts +1 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +0 -14
- package/dest/publisher/sequencer-publisher.d.ts +11 -16
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +53 -289
- package/dest/sequencer/checkpoint_proposal_job.d.ts +4 -10
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +75 -117
- package/dest/sequencer/checkpoint_voter.d.ts +1 -2
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_voter.js +2 -5
- package/dest/sequencer/events.d.ts +1 -2
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/metrics.d.ts +1 -5
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +0 -11
- package/dest/sequencer/sequencer.d.ts +5 -4
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +50 -59
- package/dest/test/mock_checkpoint_builder.d.ts +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +2 -0
- package/package.json +28 -27
- package/src/client/sequencer-client.ts +9 -11
- package/src/config.ts +0 -4
- package/src/global_variable_builder/global_builder.ts +22 -24
- package/src/global_variable_builder/index.ts +1 -1
- package/src/publisher/config.ts +0 -9
- package/src/publisher/index.ts +0 -3
- package/src/publisher/sequencer-publisher-factory.ts +0 -15
- package/src/publisher/sequencer-publisher.ts +51 -274
- package/src/sequencer/checkpoint_proposal_job.ts +66 -139
- package/src/sequencer/checkpoint_voter.ts +1 -12
- package/src/sequencer/events.ts +1 -1
- package/src/sequencer/metrics.ts +0 -14
- package/src/sequencer/sequencer.ts +58 -84
- package/src/test/mock_checkpoint_builder.ts +2 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +0 -11
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +0 -1
- package/dest/publisher/l1_tx_failed_store/factory.js +0 -22
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +0 -59
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +0 -1
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +0 -1
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +0 -15
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +0 -1
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +0 -34
- package/dest/publisher/l1_tx_failed_store/index.d.ts +0 -4
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +0 -1
- package/dest/publisher/l1_tx_failed_store/index.js +0 -2
- package/src/publisher/l1_tx_failed_store/factory.ts +0 -32
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +0 -55
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +0 -46
- package/src/publisher/l1_tx_failed_store/index.ts +0 -3
|
@@ -20,7 +20,7 @@ import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
|
20
20
|
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
21
21
|
|
|
22
22
|
import { type SequencerClientConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
|
|
23
|
-
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
23
|
+
import type { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
24
24
|
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
25
25
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
26
26
|
|
|
@@ -66,6 +66,7 @@ export class SequencerClient {
|
|
|
66
66
|
epochCache?: EpochCache;
|
|
67
67
|
l1TxUtils: L1TxUtils[];
|
|
68
68
|
nodeKeyStore: KeystoreManager;
|
|
69
|
+
globalVariableBuilder: GlobalVariableBuilder;
|
|
69
70
|
},
|
|
70
71
|
) {
|
|
71
72
|
const {
|
|
@@ -93,10 +94,9 @@ export class SequencerClient {
|
|
|
93
94
|
log.getBindings(),
|
|
94
95
|
);
|
|
95
96
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
96
|
-
const [l1GenesisTime, slotDuration,
|
|
97
|
+
const [l1GenesisTime, slotDuration, rollupManaLimit] = await Promise.all([
|
|
97
98
|
rollupContract.getL1GenesisTime(),
|
|
98
99
|
rollupContract.getSlotDuration(),
|
|
99
|
-
rollupContract.getVersion(),
|
|
100
100
|
rollupContract.getManaLimit().then(Number),
|
|
101
101
|
] as const);
|
|
102
102
|
|
|
@@ -113,7 +113,6 @@ export class SequencerClient {
|
|
|
113
113
|
l1ChainId: chainId,
|
|
114
114
|
viemPollingIntervalMS: config.viemPollingIntervalMS,
|
|
115
115
|
ethereumSlotDuration: config.ethereumSlotDuration,
|
|
116
|
-
enableProposerPipelining: config.enableProposerPipelining,
|
|
117
116
|
},
|
|
118
117
|
{ dateProvider: deps.dateProvider },
|
|
119
118
|
));
|
|
@@ -140,13 +139,7 @@ export class SequencerClient {
|
|
|
140
139
|
|
|
141
140
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
142
141
|
|
|
143
|
-
const globalsBuilder =
|
|
144
|
-
...config,
|
|
145
|
-
l1GenesisTime,
|
|
146
|
-
slotDuration: Number(slotDuration),
|
|
147
|
-
ethereumSlotDuration,
|
|
148
|
-
rollupVersion,
|
|
149
|
-
});
|
|
142
|
+
const globalsBuilder = deps.globalVariableBuilder;
|
|
150
143
|
|
|
151
144
|
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
152
145
|
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
@@ -215,6 +208,11 @@ export class SequencerClient {
|
|
|
215
208
|
this.l1Metrics?.stop();
|
|
216
209
|
}
|
|
217
210
|
|
|
211
|
+
/** Triggers an immediate run of the sequencer, bypassing the polling interval. */
|
|
212
|
+
public trigger() {
|
|
213
|
+
return this.sequencer.trigger();
|
|
214
|
+
}
|
|
215
|
+
|
|
218
216
|
public getSequencer(): Sequencer {
|
|
219
217
|
return this.sequencer;
|
|
220
218
|
}
|
package/src/config.ts
CHANGED
|
@@ -13,10 +13,8 @@ import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
|
13
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
14
|
import {
|
|
15
15
|
type ChainConfig,
|
|
16
|
-
type PipelineConfig,
|
|
17
16
|
type SequencerConfig,
|
|
18
17
|
chainConfigMappings,
|
|
19
|
-
pipelineConfigMappings,
|
|
20
18
|
sharedSequencerConfigMappings,
|
|
21
19
|
} from '@aztec/stdlib/config';
|
|
22
20
|
import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
|
|
@@ -70,7 +68,6 @@ export type SequencerClientConfig = SequencerPublisherConfig &
|
|
|
70
68
|
SequencerConfig &
|
|
71
69
|
L1ReaderConfig &
|
|
72
70
|
ChainConfig &
|
|
73
|
-
PipelineConfig &
|
|
74
71
|
Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
|
|
75
72
|
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
|
|
76
73
|
|
|
@@ -244,7 +241,6 @@ export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientCo
|
|
|
244
241
|
...sequencerTxSenderConfigMappings,
|
|
245
242
|
...sequencerPublisherConfigMappings,
|
|
246
243
|
...chainConfigMappings,
|
|
247
|
-
...pipelineConfigMappings,
|
|
248
244
|
...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
|
|
249
245
|
};
|
|
250
246
|
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
2
|
-
import { makeL1HttpTransport } from '@aztec/ethereum/client';
|
|
3
|
-
import type { L1ContractsConfig } from '@aztec/ethereum/config';
|
|
4
1
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
-
import type {
|
|
2
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
6
3
|
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
7
4
|
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
8
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
9
6
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
7
|
import { createLogger } from '@aztec/foundation/log';
|
|
8
|
+
import type { DateProvider } from '@aztec/foundation/timer';
|
|
11
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
-
import { type L1RollupConstants, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
10
|
+
import { type L1RollupConstants, getNextL1SlotTimestamp, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
13
11
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
14
12
|
import type {
|
|
15
13
|
CheckpointGlobalVariables,
|
|
@@ -17,7 +15,12 @@ import type {
|
|
|
17
15
|
} from '@aztec/stdlib/tx';
|
|
18
16
|
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
/** Configuration for the GlobalVariableBuilder (excludes L1 client config). */
|
|
19
|
+
export type GlobalVariableBuilderConfig = {
|
|
20
|
+
l1Contracts: Pick<L1ContractAddresses, 'rollupAddress'>;
|
|
21
|
+
ethereumSlotDuration: number;
|
|
22
|
+
rollupVersion: bigint;
|
|
23
|
+
} & Pick<L1RollupConstants, 'slotDuration' | 'l1GenesisTime'>;
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Simple global variables builder.
|
|
@@ -28,7 +31,6 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
28
31
|
private currentL1BlockNumber: bigint | undefined = undefined;
|
|
29
32
|
|
|
30
33
|
private readonly rollupContract: RollupContract;
|
|
31
|
-
private readonly publicClient: ViemPublicClient;
|
|
32
34
|
private readonly ethereumSlotDuration: number;
|
|
33
35
|
private readonly aztecSlotDuration: number;
|
|
34
36
|
private readonly l1GenesisTime: bigint;
|
|
@@ -37,28 +39,18 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
37
39
|
private version: Fr;
|
|
38
40
|
|
|
39
41
|
constructor(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
private readonly dateProvider: DateProvider,
|
|
43
|
+
private readonly publicClient: ViemPublicClient,
|
|
44
|
+
config: GlobalVariableBuilderConfig,
|
|
43
45
|
) {
|
|
44
|
-
const { l1RpcUrls, l1ChainId: chainId, l1Contracts } = config;
|
|
45
|
-
|
|
46
|
-
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
47
|
-
|
|
48
46
|
this.version = new Fr(config.rollupVersion);
|
|
49
|
-
this.chainId = new Fr(
|
|
47
|
+
this.chainId = new Fr(this.publicClient.chain!.id);
|
|
50
48
|
|
|
51
49
|
this.ethereumSlotDuration = config.ethereumSlotDuration;
|
|
52
50
|
this.aztecSlotDuration = config.slotDuration;
|
|
53
51
|
this.l1GenesisTime = config.l1GenesisTime;
|
|
54
52
|
|
|
55
|
-
this.
|
|
56
|
-
chain: chain.chainInfo,
|
|
57
|
-
transport: makeL1HttpTransport(chain.rpcUrls, { timeout: config.l1HttpTimeoutMS }),
|
|
58
|
-
pollingInterval: config.viemPollingIntervalMS,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
this.rollupContract = new RollupContract(this.publicClient, l1Contracts.rollupAddress);
|
|
53
|
+
this.rollupContract = new RollupContract(this.publicClient, config.l1Contracts.rollupAddress);
|
|
62
54
|
}
|
|
63
55
|
|
|
64
56
|
/**
|
|
@@ -74,7 +66,10 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
74
66
|
const earliestTimestamp = await this.rollupContract.getTimestampForSlot(
|
|
75
67
|
SlotNumber.fromBigInt(BigInt(lastCheckpoint.slotNumber) + 1n),
|
|
76
68
|
);
|
|
77
|
-
const nextEthTimestamp =
|
|
69
|
+
const nextEthTimestamp = getNextL1SlotTimestamp(this.dateProvider.nowInSeconds(), {
|
|
70
|
+
l1GenesisTime: this.l1GenesisTime,
|
|
71
|
+
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
72
|
+
});
|
|
78
73
|
const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
|
|
79
74
|
|
|
80
75
|
return new GasFees(0, await this.rollupContract.getManaMinFeeAt(timestamp, true));
|
|
@@ -109,7 +104,10 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
109
104
|
const slot: SlotNumber =
|
|
110
105
|
maybeSlot ??
|
|
111
106
|
(await this.rollupContract.getSlotAt(
|
|
112
|
-
|
|
107
|
+
getNextL1SlotTimestamp(this.dateProvider.nowInSeconds(), {
|
|
108
|
+
l1GenesisTime: this.l1GenesisTime,
|
|
109
|
+
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
110
|
+
}),
|
|
113
111
|
));
|
|
114
112
|
|
|
115
113
|
const checkpointGlobalVariables = await this.buildCheckpointGlobalVariables(coinbase, feeRecipient, slot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { GlobalVariableBuilder } from './global_builder.js';
|
|
1
|
+
export { GlobalVariableBuilder, type GlobalVariableBuilderConfig } from './global_builder.js';
|
package/src/publisher/config.ts
CHANGED
|
@@ -48,8 +48,6 @@ export type PublisherConfig = L1TxUtilsConfig &
|
|
|
48
48
|
fishermanMode?: boolean;
|
|
49
49
|
/** Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only) */
|
|
50
50
|
publisherForwarderAddress?: EthAddress;
|
|
51
|
-
/** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
|
|
52
|
-
l1TxFailedStore?: string;
|
|
53
51
|
};
|
|
54
52
|
|
|
55
53
|
export type ProverPublisherConfig = L1TxUtilsConfig &
|
|
@@ -64,8 +62,6 @@ export type SequencerPublisherConfig = L1TxUtilsConfig &
|
|
|
64
62
|
fishermanMode?: boolean;
|
|
65
63
|
sequencerPublisherAllowInvalidStates?: boolean;
|
|
66
64
|
sequencerPublisherForwarderAddress?: EthAddress;
|
|
67
|
-
/** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
|
|
68
|
-
l1TxFailedStore?: string;
|
|
69
65
|
};
|
|
70
66
|
|
|
71
67
|
export function getPublisherConfigFromProverConfig(config: ProverPublisherConfig): PublisherConfig {
|
|
@@ -81,7 +77,6 @@ export function getPublisherConfigFromSequencerConfig(config: SequencerPublisher
|
|
|
81
77
|
...config,
|
|
82
78
|
publisherAllowInvalidStates: config.sequencerPublisherAllowInvalidStates,
|
|
83
79
|
publisherForwarderAddress: config.sequencerPublisherForwarderAddress,
|
|
84
|
-
l1TxFailedStore: config.l1TxFailedStore,
|
|
85
80
|
};
|
|
86
81
|
}
|
|
87
82
|
|
|
@@ -138,10 +133,6 @@ export const sequencerPublisherConfigMappings: ConfigMappingsType<SequencerPubli
|
|
|
138
133
|
description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
|
|
139
134
|
parseEnv: (val: string) => (val ? EthAddress.fromString(val) : undefined),
|
|
140
135
|
},
|
|
141
|
-
l1TxFailedStore: {
|
|
142
|
-
env: 'L1_TX_FAILED_STORE',
|
|
143
|
-
description: 'Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path',
|
|
144
|
-
},
|
|
145
136
|
};
|
|
146
137
|
|
|
147
138
|
export const proverPublisherConfigMappings: ConfigMappingsType<ProverPublisherConfig & L1TxUtilsConfig> = {
|
package/src/publisher/index.ts
CHANGED
|
@@ -3,6 +3,3 @@ export { SequencerPublisherFactory } from './sequencer-publisher-factory.js';
|
|
|
3
3
|
|
|
4
4
|
// Used for tests
|
|
5
5
|
export { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
6
|
-
|
|
7
|
-
// Failed L1 tx store (optional, for test networks)
|
|
8
|
-
export { type FailedL1Tx, type FailedL1TxUri, type L1TxFailedStore } from './l1_tx_failed_store/index.js';
|
|
@@ -81,23 +81,8 @@ export class SequencerPublisherFactory {
|
|
|
81
81
|
const rollup = this.deps.rollupContract;
|
|
82
82
|
const slashingProposerContract = await rollup.getSlashingProposer();
|
|
83
83
|
|
|
84
|
-
const getNextPublisher = async (excludeAddresses: EthAddress[]): Promise<L1TxUtils | undefined> => {
|
|
85
|
-
const exclusionFilter: PublisherFilter<L1TxUtils> = (utils: L1TxUtils) => {
|
|
86
|
-
if (excludeAddresses.some(addr => addr.equals(utils.getSenderAddress()))) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
return filter(utils);
|
|
90
|
-
};
|
|
91
|
-
try {
|
|
92
|
-
return await this.deps.publisherManager.getAvailablePublisher(exclusionFilter);
|
|
93
|
-
} catch {
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
84
|
const publisher = new SequencerPublisher(this.sequencerConfig, {
|
|
99
85
|
l1TxUtils: l1Publisher,
|
|
100
|
-
getNextPublisher,
|
|
101
86
|
telemetry: this.deps.telemetry,
|
|
102
87
|
blobClient: this.deps.blobClient,
|
|
103
88
|
rollupContract: this.deps.rollupContract,
|