@aztec/sequencer-client 2.1.0-rc.1 → 2.1.0-rc.2
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.map +1 -1
- package/dest/client/sequencer-client.js +2 -0
- package/dest/publisher/config.d.ts +0 -4
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +1 -12
- package/dest/publisher/sequencer-publisher.d.ts +2 -6
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +4 -12
- 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/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +11 -4
- package/dest/sequencer/timetable.d.ts +0 -6
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +2 -9
- package/dest/sequencer/utils.d.ts +10 -24
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +9 -24
- package/package.json +27 -27
- package/src/client/sequencer-client.ts +2 -0
- package/src/publisher/config.ts +1 -17
- package/src/publisher/sequencer-publisher.ts +10 -18
- package/src/sequencer/errors.ts +21 -0
- package/src/sequencer/sequencer.ts +9 -8
- package/src/sequencer/timetable.ts +2 -13
- package/src/sequencer/utils.ts +10 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-client.d.ts","sourceRoot":"","sources":["../../src/client/sequencer-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAEL,gBAAgB,EAIjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,U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,CAAC;QAC7B,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,SAAS,EAAE,eAAe,CAAC;QAC3B,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;QAC7C,cAAc,CAAC,EAAE,uBAAuB,CAAC;QACzC,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,SAAS,EAAE,kBAAkB,EAAE,CAAC;QAChC,YAAY,EAAE,eAAe,CAAC;KAC/B;IAoHH;;;OAGG;IACI,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAMhF,4BAA4B;IACf,KAAK;IAOlB;;OAEG;IACU,IAAI;IAOV,YAAY,IAAI,SAAS;IAIhC,IAAI,kBAAkB,IAAI,UAAU,EAAE,GAAG,SAAS,CAEjD;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;CACF"}
|
|
@@ -109,11 +109,13 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
109
109
|
await this.validatorClient?.start();
|
|
110
110
|
this.sequencer.start();
|
|
111
111
|
this.l1Metrics?.start();
|
|
112
|
+
await this.publisherManager.loadState();
|
|
112
113
|
}
|
|
113
114
|
/**
|
|
114
115
|
* Stops the sequencer from processing new txs.
|
|
115
116
|
*/ async stop() {
|
|
116
117
|
await this.sequencer.stop();
|
|
118
|
+
await this.validatorClient?.stop();
|
|
117
119
|
this.publisherManager.interrupt();
|
|
118
120
|
this.l1Metrics?.stop();
|
|
119
121
|
}
|
|
@@ -14,15 +14,11 @@ export type TxSenderConfig = L1ReaderConfig & {
|
|
|
14
14
|
* Publisher addresses to be used with a remote signer
|
|
15
15
|
*/
|
|
16
16
|
publisherAddresses?: EthAddress[];
|
|
17
|
-
/** Whether this publisher is enabled */
|
|
18
|
-
publisherEnabled?: boolean;
|
|
19
17
|
};
|
|
20
18
|
/**
|
|
21
19
|
* Configuration of the L1Publisher.
|
|
22
20
|
*/
|
|
23
21
|
export type PublisherConfig = L1TxUtilsConfig & BlobSinkConfig & {
|
|
24
|
-
/** The interval to wait between publish retries. */
|
|
25
|
-
l1PublishRetryIntervalMS: number;
|
|
26
22
|
/** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
|
|
27
23
|
publisherAllowInvalidStates?: boolean;
|
|
28
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/publisher/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C;;OAEG;IACH,oBAAoB,CAAC,EAAE,WAAW,CAAC,KAAK,MAAM,EAAE,CAAC,EAAE,CAAC;IAEpD;;OAEG;IACH,kBAAkB,CAAC,EAAE,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/publisher/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C;;OAEG;IACH,oBAAoB,CAAC,EAAE,WAAW,CAAC,KAAK,MAAM,EAAE,CAAC,EAAE,CAAC;IAEpD;;OAEG;IACH,kBAAkB,CAAC,EAAE,UAAU,EAAE,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAC3C,cAAc,GAAG;IACf,oGAAoG;IACpG,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,CAAC;AAEJ,eAAO,MAAM,yBAAyB,EAAE,CACtC,KAAK,EAAE,QAAQ,GAAG,KAAK,KACpB,kBAAkB,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAezD,CAAC;AAEH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAErG;AAED,eAAO,MAAM,0BAA0B,EAAE,CACvC,KAAK,EAAE,QAAQ,GAAG,KAAK,KACpB,kBAAkB,CAAC,eAAe,GAAG,eAAe,CAQvD,CAAC;AAEH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,eAAe,CAElF"}
|
package/dest/publisher/config.js
CHANGED
|
@@ -18,27 +18,16 @@ export const getTxSenderConfigMappings = (scope)=>({
|
|
|
18
18
|
description: 'The addresses of the publishers to use with remote signers',
|
|
19
19
|
parseEnv: (val)=>val.split(',').map((address)=>EthAddress.fromString(address)),
|
|
20
20
|
defaultValue: []
|
|
21
|
-
},
|
|
22
|
-
publisherEnabled: {
|
|
23
|
-
env: scope === 'PROVER' ? `PROVER_PUBLISHER_ENABLED` : `SEQ_PUBLISHER_ENABLED`,
|
|
24
|
-
description: 'Whether this L1 publisher is enabled',
|
|
25
|
-
...booleanConfigHelper(true)
|
|
26
21
|
}
|
|
27
22
|
});
|
|
28
23
|
export function getTxSenderConfigFromEnv(scope) {
|
|
29
24
|
return getConfigFromMappings(getTxSenderConfigMappings(scope));
|
|
30
25
|
}
|
|
31
26
|
export const getPublisherConfigMappings = (scope)=>({
|
|
32
|
-
l1PublishRetryIntervalMS: {
|
|
33
|
-
env: scope === `PROVER` ? `PROVER_PUBLISH_RETRY_INTERVAL_MS` : `SEQ_PUBLISH_RETRY_INTERVAL_MS`,
|
|
34
|
-
parseEnv: (val)=>+val,
|
|
35
|
-
defaultValue: 1000,
|
|
36
|
-
description: 'The interval to wait between publish retries.'
|
|
37
|
-
},
|
|
38
27
|
publisherAllowInvalidStates: {
|
|
39
28
|
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
40
29
|
env: scope === `PROVER` ? `PROVER_PUBLISHER_ALLOW_INVALID_STATES` : `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
41
|
-
...booleanConfigHelper(
|
|
30
|
+
...booleanConfigHelper(true)
|
|
42
31
|
},
|
|
43
32
|
...l1TxUtilsConfigMappings,
|
|
44
33
|
...blobSinkConfigMapping
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { L2Block } from '@aztec/aztec.js';
|
|
2
2
|
import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
3
3
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
4
|
-
import { type EmpireSlashingProposerContract, FormattedViemError, type
|
|
4
|
+
import { type EmpireSlashingProposerContract, FormattedViemError, type GovernanceProposerContract, type L1BlobInputs, type L1ContractsConfig, type L1TxConfig, type L1TxRequest, RollupContract, type TallySlashingProposerContract, type TransactionStats } from '@aztec/ethereum';
|
|
5
5
|
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
6
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
7
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
@@ -30,18 +30,16 @@ interface RequestWithExpiry {
|
|
|
30
30
|
action: Action;
|
|
31
31
|
request: L1TxRequest;
|
|
32
32
|
lastValidL2Slot: bigint;
|
|
33
|
-
gasConfig?: Pick<
|
|
33
|
+
gasConfig?: Pick<L1TxConfig, 'txTimeoutAt' | 'gasLimit'>;
|
|
34
34
|
blobConfig?: L1BlobInputs;
|
|
35
35
|
checkSuccess: (request: L1TxRequest, result?: {
|
|
36
36
|
receipt: TransactionReceipt;
|
|
37
|
-
gasPrice: GasPrice;
|
|
38
37
|
stats?: TransactionStats;
|
|
39
38
|
errorMsg?: string;
|
|
40
39
|
}) => boolean;
|
|
41
40
|
}
|
|
42
41
|
export declare class SequencerPublisher {
|
|
43
42
|
private config;
|
|
44
|
-
private enabled;
|
|
45
43
|
private interrupted;
|
|
46
44
|
private metrics;
|
|
47
45
|
epochCache: EpochCache;
|
|
@@ -88,12 +86,10 @@ export declare class SequencerPublisher {
|
|
|
88
86
|
sendRequests(): Promise<{
|
|
89
87
|
result: FormattedViemError | {
|
|
90
88
|
receipt: import("viem").TransactionReceipt;
|
|
91
|
-
gasPrice: GasPrice;
|
|
92
89
|
stats: TransactionStats | undefined;
|
|
93
90
|
errorMsg?: undefined;
|
|
94
91
|
} | {
|
|
95
92
|
receipt: import("viem").TransactionReceipt;
|
|
96
|
-
gasPrice: GasPrice;
|
|
97
93
|
errorMsg: string | undefined;
|
|
98
94
|
stats?: undefined;
|
|
99
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,KAAK,8BAA8B,EACnC,kBAAkB,EAClB,KAAK,
|
|
1
|
+
{"version":3,"file":"sequencer-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,KAAK,uBAAuB,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,CAAC,OAAO,EAAE,sBAAsB,GAAG,SAAS,EAAE,IAAI,GAAE;QAAE,WAAW,CAAC,EAAE,IAAI,CAAA;KAAO;YAgC9F,yBAAyB;IAoDvC;;;;;OAKG;IACI,SAAS;IAKhB,wDAAwD;IACjD,OAAO;YAKA,gBAAgB;IAsD9B;;;;;OAKG;YACW,iBAAiB;YAoEjB,YAAY;CAkF3B"}
|
|
@@ -29,7 +29,6 @@ export const Actions = [
|
|
|
29
29
|
export const compareActions = (a, b)=>Actions.indexOf(a) - Actions.indexOf(b);
|
|
30
30
|
export class SequencerPublisher {
|
|
31
31
|
config;
|
|
32
|
-
enabled;
|
|
33
32
|
interrupted;
|
|
34
33
|
metrics;
|
|
35
34
|
epochCache;
|
|
@@ -60,7 +59,6 @@ export class SequencerPublisher {
|
|
|
60
59
|
this.slashingLog = createLogger('sequencer:publisher:slashing');
|
|
61
60
|
this.lastActions = {};
|
|
62
61
|
this.requests = [];
|
|
63
|
-
this.enabled = config.publisherEnabled ?? true;
|
|
64
62
|
this.log = deps.log ?? createLogger('sequencer:publisher');
|
|
65
63
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
66
64
|
this.epochCache = deps.epochCache;
|
|
@@ -100,13 +98,6 @@ export class SequencerPublisher {
|
|
|
100
98
|
* - a receipt and errorMsg if it failed on L1
|
|
101
99
|
* - undefined if no valid requests are found OR the tx failed to send.
|
|
102
100
|
*/ async sendRequests() {
|
|
103
|
-
if (!this.enabled) {
|
|
104
|
-
this.log.warn(`Sending L1 txs is disabled`, {
|
|
105
|
-
requestsDiscarded: this.requests.map((r)=>r.action)
|
|
106
|
-
});
|
|
107
|
-
this.requests = [];
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
101
|
const requestsToProcess = [
|
|
111
102
|
...this.requests
|
|
112
103
|
];
|
|
@@ -149,7 +140,7 @@ export class SequencerPublisher {
|
|
|
149
140
|
const gasLimit = gasLimits.length > 0 ? sumBigint(gasLimits) : undefined; // sum
|
|
150
141
|
const txTimeoutAts = gasConfigs.map((g)=>g?.txTimeoutAt).filter((g)=>g !== undefined);
|
|
151
142
|
const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map((g)=>g.getTime()))) : undefined; // earliest
|
|
152
|
-
const
|
|
143
|
+
const txConfig = {
|
|
153
144
|
gasLimit,
|
|
154
145
|
txTimeoutAt
|
|
155
146
|
};
|
|
@@ -158,9 +149,10 @@ export class SequencerPublisher {
|
|
|
158
149
|
validRequests.sort((a, b)=>compareActions(a.action, b.action));
|
|
159
150
|
try {
|
|
160
151
|
this.log.debug('Forwarding transactions', {
|
|
161
|
-
validRequests: validRequests.map((request)=>request.action)
|
|
152
|
+
validRequests: validRequests.map((request)=>request.action),
|
|
153
|
+
txConfig
|
|
162
154
|
});
|
|
163
|
-
const result = await Multicall3.forward(validRequests.map((request)=>request.request), this.l1TxUtils,
|
|
155
|
+
const result = await Multicall3.forward(validRequests.map((request)=>request.request), this.l1TxUtils, txConfig, blobConfig, this.rollupContract.address, this.log);
|
|
164
156
|
const { successfulActions = [], failedActions = [] } = this.callbackBundledTransactions(validRequests, result);
|
|
165
157
|
return {
|
|
166
158
|
result,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SequencerState } from './utils.js';
|
|
2
|
+
export declare class SequencerTooSlowError extends Error {
|
|
3
|
+
readonly proposedState: SequencerState;
|
|
4
|
+
readonly maxAllowedTime: number;
|
|
5
|
+
readonly currentTime: number;
|
|
6
|
+
constructor(proposedState: SequencerState, maxAllowedTime: number, currentTime: number);
|
|
7
|
+
}
|
|
8
|
+
export declare class SequencerInterruptedError extends Error {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/sequencer/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,qBAAsB,SAAQ,KAAK;aAE5B,aAAa,EAAE,cAAc;aAC7B,cAAc,EAAE,MAAM;aACtB,WAAW,EAAE,MAAM;gBAFnB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM;CAOtC;AAED,qBAAa,yBAA0B,SAAQ,KAAK;;CAKnD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class SequencerTooSlowError extends Error {
|
|
2
|
+
proposedState;
|
|
3
|
+
maxAllowedTime;
|
|
4
|
+
currentTime;
|
|
5
|
+
constructor(proposedState, maxAllowedTime, currentTime){
|
|
6
|
+
super(`Too far into slot for ${proposedState} (time into slot ${currentTime}s greater than ${maxAllowedTime}s allowance)`), this.proposedState = proposedState, this.maxAllowedTime = maxAllowedTime, this.currentTime = currentTime;
|
|
7
|
+
this.name = 'SequencerTooSlowError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class SequencerInterruptedError extends Error {
|
|
11
|
+
constructor(){
|
|
12
|
+
super(`Sequencer was interrupted`);
|
|
13
|
+
this.name = 'SequencerInterruptedError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5F,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY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,aAAa,CAAC,CAAC,CAAC,CAAC,EACpE,WAAW,EAAE,MAAM,EACnB,qBAAqB,EAAE,UAAU,EAAE,EACnC,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC;IA6DhB,OAAO,CAAC,0BAA0B;IAIlC,OAAO,CAAC,kBAAkB;IAK1B,IAAI,iBAAiB,WAEpB;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAEM,gBAAgB,IAAI,sBAAsB,GAAG,SAAS;CAG9D"}
|
|
@@ -14,7 +14,7 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
14
14
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
15
15
|
import { Timer } from '@aztec/foundation/timer';
|
|
16
16
|
import { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
17
|
-
import { getSlotAtTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
17
|
+
import { getSlotAtTimestamp, getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
18
18
|
import { Gas } from '@aztec/stdlib/gas';
|
|
19
19
|
import { SequencerConfigSchema } from '@aztec/stdlib/interfaces/server';
|
|
20
20
|
import { orderAttestations } from '@aztec/stdlib/p2p';
|
|
@@ -24,8 +24,9 @@ import { ContentCommitment, ProposedBlockHeader } from '@aztec/stdlib/tx';
|
|
|
24
24
|
import { AttestationTimeoutError } from '@aztec/stdlib/validators';
|
|
25
25
|
import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
26
26
|
import EventEmitter from 'node:events';
|
|
27
|
+
import { SequencerInterruptedError, SequencerTooSlowError } from './errors.js';
|
|
27
28
|
import { SequencerMetrics } from './metrics.js';
|
|
28
|
-
import { SequencerTimetable
|
|
29
|
+
import { SequencerTimetable } from './timetable.js';
|
|
29
30
|
import { SequencerState } from './utils.js';
|
|
30
31
|
export { SequencerState };
|
|
31
32
|
/**
|
|
@@ -150,8 +151,10 @@ export { SequencerState };
|
|
|
150
151
|
* Stops the sequencer from processing txs and moves to STOPPED state.
|
|
151
152
|
*/ async stop() {
|
|
152
153
|
this.log.info(`Stopping sequencer`);
|
|
154
|
+
this.setState(SequencerState.STOPPING, undefined, {
|
|
155
|
+
force: true
|
|
156
|
+
});
|
|
153
157
|
this.publisher?.interrupt();
|
|
154
|
-
await this.validatorClient?.stop();
|
|
155
158
|
await this.runningPromise?.stop();
|
|
156
159
|
this.setState(SequencerState.STOPPED, undefined, {
|
|
157
160
|
force: true
|
|
@@ -404,6 +407,10 @@ export { SequencerState };
|
|
|
404
407
|
}
|
|
405
408
|
}
|
|
406
409
|
setState(proposedState, slotNumber, opts = {}) {
|
|
410
|
+
if (this.state === SequencerState.STOPPING && proposedState !== SequencerState.STOPPED && !opts.force) {
|
|
411
|
+
this.log.warn(`Cannot set sequencer to ${proposedState} as it is stopping.`);
|
|
412
|
+
throw new SequencerInterruptedError();
|
|
413
|
+
}
|
|
407
414
|
if (this.state === SequencerState.STOPPED && !opts.force) {
|
|
408
415
|
this.log.warn(`Cannot set sequencer from ${this.state} to ${proposedState} as it is stopped.`);
|
|
409
416
|
return;
|
|
@@ -688,7 +695,7 @@ export { SequencerState };
|
|
|
688
695
|
await publisher.sendRequests();
|
|
689
696
|
}
|
|
690
697
|
getSlotStartBuildTimestamp(slotNumber) {
|
|
691
|
-
return
|
|
698
|
+
return getSlotStartBuildTimestamp(slotNumber, this.l1Constants);
|
|
692
699
|
}
|
|
693
700
|
getSecondsIntoSlot(slotNumber) {
|
|
694
701
|
const slotStartTimestamp = this.getSlotStartBuildTimestamp(slotNumber);
|
|
@@ -45,10 +45,4 @@ export declare class SequencerTimetable {
|
|
|
45
45
|
getMaxAllowedTime(state: SequencerState): number | undefined;
|
|
46
46
|
assertTimeLeft(newState: SequencerState, secondsIntoSlot: number): void;
|
|
47
47
|
}
|
|
48
|
-
export declare class SequencerTooSlowError extends Error {
|
|
49
|
-
readonly proposedState: SequencerState;
|
|
50
|
-
readonly maxAllowedTime: number;
|
|
51
|
-
readonly currentTime: number;
|
|
52
|
-
constructor(proposedState: SequencerState, maxAllowedTime: number, currentTime: number);
|
|
53
|
-
}
|
|
54
48
|
//# sourceMappingURL=timetable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetable.d.ts","sourceRoot":"","sources":["../../src/sequencer/timetable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timetable.d.ts","sourceRoot":"","sources":["../../src/sequencer/timetable.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5C,qBAAa,kBAAkB;IA+C3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IA/CtB;;;;OAIG;IACH,SAAgB,kBAAkB,EAAE,MAAM,CAAC;IAE3C;;;;OAIG;IACH,SAAgB,gBAAgB,SAAC;IAEjC,sHAAsH;IACtH,SAAgB,gBAAgB,EAAE,MAAM,CAAsB;IAE9D,uDAAuD;IACvD,SAAgB,gBAAgB,EAAE,MAAM,CAAsB;IAE9D,mGAAmG;IACnG,SAAgB,0BAA0B,EAAE,MAAM,CAAC;IAEnD,mIAAmI;IACnI,SAAgB,mBAAmB,EAAE,MAAM,CAAyB;IAEpE,wCAAwC;IACxC,SAAgB,oBAAoB,EAAE,MAAM,CAAC;IAE7C,kFAAkF;IAClF,SAAgB,iBAAiB,EAAE,MAAM,CAAC;IAE1C,2IAA2I;IAC3I,SAAgB,4BAA4B,EAAE,MAAM,CAAC;IAErD,4DAA4D;IAC5D,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAG/B,IAAI,EAAE;QACJ,oBAAoB,EAAE,MAAM,CAAC;QAC7B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,4BAA4B,EAAE,MAAM,CAAC;QACrC,0BAA0B,CAAC,EAAE,MAAM,CAAC;QACpC,OAAO,EAAE,OAAO,CAAC;KAClB,EACgB,OAAO,CAAC,EAAE,gBAAgB,YAAA,EAC1B,GAAG,mCAAsC;IA+C5D,OAAO,KAAK,yCAAyC,GAEpD;IAEM,2BAA2B,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM;IAenE,OAAO,KAAK,0BAA0B,GAErC;IAEM,yBAAyB,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM;IAU3D,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IAuB5D,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM;CAkBxE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/aztec.js';
|
|
2
2
|
import { DEFAULT_ATTESTATION_PROPAGATION_TIME } from '../config.js';
|
|
3
|
+
import { SequencerTooSlowError } from './errors.js';
|
|
3
4
|
import { SequencerState } from './utils.js';
|
|
4
5
|
const MIN_EXECUTION_TIME = 1;
|
|
5
6
|
const BLOCK_PREPARE_TIME = 1;
|
|
@@ -95,6 +96,7 @@ export class SequencerTimetable {
|
|
|
95
96
|
getMaxAllowedTime(state) {
|
|
96
97
|
switch(state){
|
|
97
98
|
case SequencerState.STOPPED:
|
|
99
|
+
case SequencerState.STOPPING:
|
|
98
100
|
case SequencerState.IDLE:
|
|
99
101
|
case SequencerState.SYNCHRONIZING:
|
|
100
102
|
return; // We don't really care about times for this states
|
|
@@ -133,12 +135,3 @@ export class SequencerTimetable {
|
|
|
133
135
|
});
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
|
-
export class SequencerTooSlowError extends Error {
|
|
137
|
-
proposedState;
|
|
138
|
-
maxAllowedTime;
|
|
139
|
-
currentTime;
|
|
140
|
-
constructor(proposedState, maxAllowedTime, currentTime){
|
|
141
|
-
super(`Too far into slot for ${proposedState} (time into slot ${currentTime}s greater than ${maxAllowedTime}s allowance)`), this.proposedState = proposedState, this.maxAllowedTime = maxAllowedTime, this.currentTime = currentTime;
|
|
142
|
-
this.name = 'SequencerTooSlowError';
|
|
143
|
-
}
|
|
144
|
-
}
|
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
export declare enum SequencerState {
|
|
2
|
-
/**
|
|
3
|
-
* Sequencer is stopped and not processing any txs from the pool.
|
|
4
|
-
*/
|
|
2
|
+
/** Sequencer is stopped and not processing any txs from the pool. */
|
|
5
3
|
STOPPED = "STOPPED",
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/** Sequencer is being stopped. Will move to STOPPED shortly. */
|
|
5
|
+
STOPPING = "STOPPING",
|
|
6
|
+
/** Sequencer is awaiting the next call to work(). */
|
|
9
7
|
IDLE = "IDLE",
|
|
10
|
-
/**
|
|
11
|
-
* Synchronizing with the L2 chain.
|
|
12
|
-
*/
|
|
8
|
+
/** Synchronizing with the L2 chain. */
|
|
13
9
|
SYNCHRONIZING = "SYNCHRONIZING",
|
|
14
|
-
/**
|
|
15
|
-
* Checking if we are the proposer for the current slot.
|
|
16
|
-
*/
|
|
10
|
+
/** Checking if we are the proposer for the current slot. */
|
|
17
11
|
PROPOSER_CHECK = "PROPOSER_CHECK",
|
|
18
|
-
/**
|
|
19
|
-
* Initializing the block proposal. Will move to CREATING_BLOCK if there are valid txs to include, or back to SYNCHRONIZING otherwise.
|
|
20
|
-
*/
|
|
12
|
+
/** Initializing the block proposal. Will move to CREATING_BLOCK if there are valid txs to include, or back to SYNCHRONIZING otherwise. */
|
|
21
13
|
INITIALIZING_PROPOSAL = "INITIALIZING_PROPOSAL",
|
|
22
|
-
/**
|
|
23
|
-
* Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA.
|
|
24
|
-
*/
|
|
14
|
+
/** Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA. */
|
|
25
15
|
CREATING_BLOCK = "CREATING_BLOCK",
|
|
26
|
-
/**
|
|
27
|
-
* Collecting attestations from its peers. Will move to PUBLISHING_BLOCK.
|
|
28
|
-
*/
|
|
16
|
+
/** Collecting attestations from its peers. Will move to PUBLISHING_BLOCK. */
|
|
29
17
|
COLLECTING_ATTESTATIONS = "COLLECTING_ATTESTATIONS",
|
|
30
|
-
/**
|
|
31
|
-
* Sending the tx to L1 with the L2 block data and awaiting it to be mined. Will move to SYNCHRONIZING.
|
|
32
|
-
*/
|
|
18
|
+
/** Sending the tx to L1 with the L2 block data and awaiting it to be mined. Will move to SYNCHRONIZING. */
|
|
33
19
|
PUBLISHING_BLOCK = "PUBLISHING_BLOCK"
|
|
34
20
|
}
|
|
35
21
|
export type SequencerStateWithSlot = SequencerState.INITIALIZING_PROPOSAL | SequencerState.CREATING_BLOCK | SequencerState.COLLECTING_ATTESTATIONS | SequencerState.PUBLISHING_BLOCK | SequencerState.PROPOSER_CHECK;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,qEAAqE;IACrE,OAAO,YAAY;IACnB,gEAAgE;IAChE,QAAQ,aAAa;IACrB,qDAAqD;IACrD,IAAI,SAAS;IACb,uCAAuC;IACvC,aAAa,kBAAkB;IAC/B,4DAA4D;IAC5D,cAAc,mBAAmB;IACjC,0IAA0I;IAC1I,qBAAqB,0BAA0B;IAC/C,6IAA6I;IAC7I,cAAc,mBAAmB;IACjC,6EAA6E;IAC7E,uBAAuB,4BAA4B;IACnD,2GAA2G;IAC3G,gBAAgB,qBAAqB;CACtC;AAED,MAAM,MAAM,sBAAsB,GAC9B,cAAc,CAAC,qBAAqB,GACpC,cAAc,CAAC,cAAc,GAC7B,cAAc,CAAC,uBAAuB,GACtC,cAAc,CAAC,gBAAgB,GAC/B,cAAc,CAAC,cAAc,CAAC;AAElC,MAAM,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC;AAE1D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAEpE"}
|
package/dest/sequencer/utils.js
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
export var SequencerState = /*#__PURE__*/ function(SequencerState) {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Checking if we are the proposer for the current slot.
|
|
13
|
-
*/ SequencerState["PROPOSER_CHECK"] = "PROPOSER_CHECK";
|
|
14
|
-
/**
|
|
15
|
-
* Initializing the block proposal. Will move to CREATING_BLOCK if there are valid txs to include, or back to SYNCHRONIZING otherwise.
|
|
16
|
-
*/ SequencerState["INITIALIZING_PROPOSAL"] = "INITIALIZING_PROPOSAL";
|
|
17
|
-
/**
|
|
18
|
-
* Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA.
|
|
19
|
-
*/ SequencerState["CREATING_BLOCK"] = "CREATING_BLOCK";
|
|
20
|
-
/**
|
|
21
|
-
* Collecting attestations from its peers. Will move to PUBLISHING_BLOCK.
|
|
22
|
-
*/ SequencerState["COLLECTING_ATTESTATIONS"] = "COLLECTING_ATTESTATIONS";
|
|
23
|
-
/**
|
|
24
|
-
* Sending the tx to L1 with the L2 block data and awaiting it to be mined. Will move to SYNCHRONIZING.
|
|
25
|
-
*/ SequencerState["PUBLISHING_BLOCK"] = "PUBLISHING_BLOCK";
|
|
2
|
+
/** Sequencer is stopped and not processing any txs from the pool. */ SequencerState["STOPPED"] = "STOPPED";
|
|
3
|
+
/** Sequencer is being stopped. Will move to STOPPED shortly. */ SequencerState["STOPPING"] = "STOPPING";
|
|
4
|
+
/** Sequencer is awaiting the next call to work(). */ SequencerState["IDLE"] = "IDLE";
|
|
5
|
+
/** Synchronizing with the L2 chain. */ SequencerState["SYNCHRONIZING"] = "SYNCHRONIZING";
|
|
6
|
+
/** Checking if we are the proposer for the current slot. */ SequencerState["PROPOSER_CHECK"] = "PROPOSER_CHECK";
|
|
7
|
+
/** Initializing the block proposal. Will move to CREATING_BLOCK if there are valid txs to include, or back to SYNCHRONIZING otherwise. */ SequencerState["INITIALIZING_PROPOSAL"] = "INITIALIZING_PROPOSAL";
|
|
8
|
+
/** Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA. */ SequencerState["CREATING_BLOCK"] = "CREATING_BLOCK";
|
|
9
|
+
/** Collecting attestations from its peers. Will move to PUBLISHING_BLOCK. */ SequencerState["COLLECTING_ATTESTATIONS"] = "COLLECTING_ATTESTATIONS";
|
|
10
|
+
/** Sending the tx to L1 with the L2 block data and awaiting it to be mined. Will move to SYNCHRONIZING. */ SequencerState["PUBLISHING_BLOCK"] = "PUBLISHING_BLOCK";
|
|
26
11
|
return SequencerState;
|
|
27
12
|
}({});
|
|
28
13
|
export function sequencerStateToNumber(state) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,37 +26,37 @@
|
|
|
26
26
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/aztec.js": "2.1.0-rc.
|
|
30
|
-
"@aztec/bb-prover": "2.1.0-rc.
|
|
31
|
-
"@aztec/blob-lib": "2.1.0-rc.
|
|
32
|
-
"@aztec/blob-sink": "2.1.0-rc.
|
|
33
|
-
"@aztec/constants": "2.1.0-rc.
|
|
34
|
-
"@aztec/epoch-cache": "2.1.0-rc.
|
|
35
|
-
"@aztec/ethereum": "2.1.0-rc.
|
|
36
|
-
"@aztec/foundation": "2.1.0-rc.
|
|
37
|
-
"@aztec/l1-artifacts": "2.1.0-rc.
|
|
38
|
-
"@aztec/merkle-tree": "2.1.0-rc.
|
|
39
|
-
"@aztec/node-keystore": "2.1.0-rc.
|
|
40
|
-
"@aztec/noir-acvm_js": "2.1.0-rc.
|
|
41
|
-
"@aztec/noir-contracts.js": "2.1.0-rc.
|
|
42
|
-
"@aztec/noir-protocol-circuits-types": "2.1.0-rc.
|
|
43
|
-
"@aztec/noir-types": "2.1.0-rc.
|
|
44
|
-
"@aztec/p2p": "2.1.0-rc.
|
|
45
|
-
"@aztec/protocol-contracts": "2.1.0-rc.
|
|
46
|
-
"@aztec/prover-client": "2.1.0-rc.
|
|
47
|
-
"@aztec/simulator": "2.1.0-rc.
|
|
48
|
-
"@aztec/slasher": "2.1.0-rc.
|
|
49
|
-
"@aztec/stdlib": "2.1.0-rc.
|
|
50
|
-
"@aztec/telemetry-client": "2.1.0-rc.
|
|
51
|
-
"@aztec/validator-client": "2.1.0-rc.
|
|
52
|
-
"@aztec/world-state": "2.1.0-rc.
|
|
29
|
+
"@aztec/aztec.js": "2.1.0-rc.2",
|
|
30
|
+
"@aztec/bb-prover": "2.1.0-rc.2",
|
|
31
|
+
"@aztec/blob-lib": "2.1.0-rc.2",
|
|
32
|
+
"@aztec/blob-sink": "2.1.0-rc.2",
|
|
33
|
+
"@aztec/constants": "2.1.0-rc.2",
|
|
34
|
+
"@aztec/epoch-cache": "2.1.0-rc.2",
|
|
35
|
+
"@aztec/ethereum": "2.1.0-rc.2",
|
|
36
|
+
"@aztec/foundation": "2.1.0-rc.2",
|
|
37
|
+
"@aztec/l1-artifacts": "2.1.0-rc.2",
|
|
38
|
+
"@aztec/merkle-tree": "2.1.0-rc.2",
|
|
39
|
+
"@aztec/node-keystore": "2.1.0-rc.2",
|
|
40
|
+
"@aztec/noir-acvm_js": "2.1.0-rc.2",
|
|
41
|
+
"@aztec/noir-contracts.js": "2.1.0-rc.2",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "2.1.0-rc.2",
|
|
43
|
+
"@aztec/noir-types": "2.1.0-rc.2",
|
|
44
|
+
"@aztec/p2p": "2.1.0-rc.2",
|
|
45
|
+
"@aztec/protocol-contracts": "2.1.0-rc.2",
|
|
46
|
+
"@aztec/prover-client": "2.1.0-rc.2",
|
|
47
|
+
"@aztec/simulator": "2.1.0-rc.2",
|
|
48
|
+
"@aztec/slasher": "2.1.0-rc.2",
|
|
49
|
+
"@aztec/stdlib": "2.1.0-rc.2",
|
|
50
|
+
"@aztec/telemetry-client": "2.1.0-rc.2",
|
|
51
|
+
"@aztec/validator-client": "2.1.0-rc.2",
|
|
52
|
+
"@aztec/world-state": "2.1.0-rc.2",
|
|
53
53
|
"lodash.chunk": "^4.2.0",
|
|
54
54
|
"tslib": "^2.4.0",
|
|
55
55
|
"viem": "2.23.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@aztec/archiver": "2.1.0-rc.
|
|
59
|
-
"@aztec/kv-store": "2.1.0-rc.
|
|
58
|
+
"@aztec/archiver": "2.1.0-rc.2",
|
|
59
|
+
"@aztec/kv-store": "2.1.0-rc.2",
|
|
60
60
|
"@jest/globals": "^30.0.0",
|
|
61
61
|
"@types/jest": "^30.0.0",
|
|
62
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
@@ -202,6 +202,7 @@ export class SequencerClient {
|
|
|
202
202
|
await this.validatorClient?.start();
|
|
203
203
|
this.sequencer.start();
|
|
204
204
|
this.l1Metrics?.start();
|
|
205
|
+
await this.publisherManager.loadState();
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
/**
|
|
@@ -209,6 +210,7 @@ export class SequencerClient {
|
|
|
209
210
|
*/
|
|
210
211
|
public async stop() {
|
|
211
212
|
await this.sequencer.stop();
|
|
213
|
+
await this.validatorClient?.stop();
|
|
212
214
|
this.publisherManager.interrupt();
|
|
213
215
|
this.l1Metrics?.stop();
|
|
214
216
|
}
|
package/src/publisher/config.ts
CHANGED
|
@@ -26,9 +26,6 @@ export type TxSenderConfig = L1ReaderConfig & {
|
|
|
26
26
|
* Publisher addresses to be used with a remote signer
|
|
27
27
|
*/
|
|
28
28
|
publisherAddresses?: EthAddress[];
|
|
29
|
-
|
|
30
|
-
/** Whether this publisher is enabled */
|
|
31
|
-
publisherEnabled?: boolean;
|
|
32
29
|
};
|
|
33
30
|
|
|
34
31
|
/**
|
|
@@ -36,8 +33,6 @@ export type TxSenderConfig = L1ReaderConfig & {
|
|
|
36
33
|
*/
|
|
37
34
|
export type PublisherConfig = L1TxUtilsConfig &
|
|
38
35
|
BlobSinkConfig & {
|
|
39
|
-
/** The interval to wait between publish retries. */
|
|
40
|
-
l1PublishRetryIntervalMS: number;
|
|
41
36
|
/** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
|
|
42
37
|
publisherAllowInvalidStates?: boolean;
|
|
43
38
|
};
|
|
@@ -59,11 +54,6 @@ export const getTxSenderConfigMappings: (
|
|
|
59
54
|
parseEnv: (val: string) => val.split(',').map(address => EthAddress.fromString(address)),
|
|
60
55
|
defaultValue: [],
|
|
61
56
|
},
|
|
62
|
-
publisherEnabled: {
|
|
63
|
-
env: scope === 'PROVER' ? `PROVER_PUBLISHER_ENABLED` : `SEQ_PUBLISHER_ENABLED`,
|
|
64
|
-
description: 'Whether this L1 publisher is enabled',
|
|
65
|
-
...booleanConfigHelper(true),
|
|
66
|
-
},
|
|
67
57
|
});
|
|
68
58
|
|
|
69
59
|
export function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'> {
|
|
@@ -73,16 +63,10 @@ export function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSender
|
|
|
73
63
|
export const getPublisherConfigMappings: (
|
|
74
64
|
scope: 'PROVER' | 'SEQ',
|
|
75
65
|
) => ConfigMappingsType<PublisherConfig & L1TxUtilsConfig> = scope => ({
|
|
76
|
-
l1PublishRetryIntervalMS: {
|
|
77
|
-
env: scope === `PROVER` ? `PROVER_PUBLISH_RETRY_INTERVAL_MS` : `SEQ_PUBLISH_RETRY_INTERVAL_MS`,
|
|
78
|
-
parseEnv: (val: string) => +val,
|
|
79
|
-
defaultValue: 1000,
|
|
80
|
-
description: 'The interval to wait between publish retries.',
|
|
81
|
-
},
|
|
82
66
|
publisherAllowInvalidStates: {
|
|
83
67
|
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
84
68
|
env: scope === `PROVER` ? `PROVER_PUBLISHER_ALLOW_INVALID_STATES` : `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
85
|
-
...booleanConfigHelper(
|
|
69
|
+
...booleanConfigHelper(true),
|
|
86
70
|
},
|
|
87
71
|
...l1TxUtilsConfigMappings,
|
|
88
72
|
...blobSinkConfigMapping,
|
|
@@ -5,12 +5,11 @@ import type { EpochCache } from '@aztec/epoch-cache';
|
|
|
5
5
|
import {
|
|
6
6
|
type EmpireSlashingProposerContract,
|
|
7
7
|
FormattedViemError,
|
|
8
|
-
type GasPrice,
|
|
9
8
|
type GovernanceProposerContract,
|
|
10
9
|
type IEmpireBase,
|
|
11
10
|
type L1BlobInputs,
|
|
12
11
|
type L1ContractsConfig,
|
|
13
|
-
type
|
|
12
|
+
type L1TxConfig,
|
|
14
13
|
type L1TxRequest,
|
|
15
14
|
MULTI_CALL_3_ADDRESS,
|
|
16
15
|
Multicall3,
|
|
@@ -92,16 +91,15 @@ interface RequestWithExpiry {
|
|
|
92
91
|
action: Action;
|
|
93
92
|
request: L1TxRequest;
|
|
94
93
|
lastValidL2Slot: bigint;
|
|
95
|
-
gasConfig?: Pick<
|
|
94
|
+
gasConfig?: Pick<L1TxConfig, 'txTimeoutAt' | 'gasLimit'>;
|
|
96
95
|
blobConfig?: L1BlobInputs;
|
|
97
96
|
checkSuccess: (
|
|
98
97
|
request: L1TxRequest,
|
|
99
|
-
result?: { receipt: TransactionReceipt;
|
|
98
|
+
result?: { receipt: TransactionReceipt; stats?: TransactionStats; errorMsg?: string },
|
|
100
99
|
) => boolean;
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
export class SequencerPublisher {
|
|
104
|
-
private enabled: boolean;
|
|
105
103
|
private interrupted = false;
|
|
106
104
|
private metrics: SequencerPublisherMetrics;
|
|
107
105
|
public epochCache: EpochCache;
|
|
@@ -151,7 +149,6 @@ export class SequencerPublisher {
|
|
|
151
149
|
log?: Logger;
|
|
152
150
|
},
|
|
153
151
|
) {
|
|
154
|
-
this.enabled = config.publisherEnabled ?? true;
|
|
155
152
|
this.log = deps.log ?? createLogger('sequencer:publisher');
|
|
156
153
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
157
154
|
this.epochCache = deps.epochCache;
|
|
@@ -201,14 +198,6 @@ export class SequencerPublisher {
|
|
|
201
198
|
* - undefined if no valid requests are found OR the tx failed to send.
|
|
202
199
|
*/
|
|
203
200
|
public async sendRequests() {
|
|
204
|
-
if (!this.enabled) {
|
|
205
|
-
this.log.warn(`Sending L1 txs is disabled`, {
|
|
206
|
-
requestsDiscarded: this.requests.map(r => r.action),
|
|
207
|
-
});
|
|
208
|
-
this.requests = [];
|
|
209
|
-
return undefined;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
201
|
const requestsToProcess = [...this.requests];
|
|
213
202
|
this.requests = [];
|
|
214
203
|
if (this.interrupted) {
|
|
@@ -257,18 +246,21 @@ export class SequencerPublisher {
|
|
|
257
246
|
const gasLimit = gasLimits.length > 0 ? sumBigint(gasLimits) : undefined; // sum
|
|
258
247
|
const txTimeoutAts = gasConfigs.map(g => g?.txTimeoutAt).filter((g): g is Date => g !== undefined);
|
|
259
248
|
const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map(g => g.getTime()))) : undefined; // earliest
|
|
260
|
-
const
|
|
249
|
+
const txConfig: RequestWithExpiry['gasConfig'] = { gasLimit, txTimeoutAt };
|
|
261
250
|
|
|
262
251
|
// Sort the requests so that proposals always go first
|
|
263
252
|
// This ensures the committee gets precomputed correctly
|
|
264
253
|
validRequests.sort((a, b) => compareActions(a.action, b.action));
|
|
265
254
|
|
|
266
255
|
try {
|
|
267
|
-
this.log.debug('Forwarding transactions', {
|
|
256
|
+
this.log.debug('Forwarding transactions', {
|
|
257
|
+
validRequests: validRequests.map(request => request.action),
|
|
258
|
+
txConfig,
|
|
259
|
+
});
|
|
268
260
|
const result = await Multicall3.forward(
|
|
269
261
|
validRequests.map(request => request.request),
|
|
270
262
|
this.l1TxUtils,
|
|
271
|
-
|
|
263
|
+
txConfig,
|
|
272
264
|
blobConfig,
|
|
273
265
|
this.rollupContract.address,
|
|
274
266
|
this.log,
|
|
@@ -293,7 +285,7 @@ export class SequencerPublisher {
|
|
|
293
285
|
|
|
294
286
|
private callbackBundledTransactions(
|
|
295
287
|
requests: RequestWithExpiry[],
|
|
296
|
-
result?: { receipt: TransactionReceipt
|
|
288
|
+
result?: { receipt: TransactionReceipt } | FormattedViemError,
|
|
297
289
|
) {
|
|
298
290
|
const actionsListStr = requests.map(r => r.action).join(', ');
|
|
299
291
|
if (result instanceof FormattedViemError) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SequencerState } from './utils.js';
|
|
2
|
+
|
|
3
|
+
export class SequencerTooSlowError extends Error {
|
|
4
|
+
constructor(
|
|
5
|
+
public readonly proposedState: SequencerState,
|
|
6
|
+
public readonly maxAllowedTime: number,
|
|
7
|
+
public readonly currentTime: number,
|
|
8
|
+
) {
|
|
9
|
+
super(
|
|
10
|
+
`Too far into slot for ${proposedState} (time into slot ${currentTime}s greater than ${maxAllowedTime}s allowance)`,
|
|
11
|
+
);
|
|
12
|
+
this.name = 'SequencerTooSlowError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class SequencerInterruptedError extends Error {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(`Sequencer was interrupted`);
|
|
19
|
+
this.name = 'SequencerInterruptedError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
type L2BlockSource,
|
|
19
19
|
type ValidateBlockResult,
|
|
20
20
|
} from '@aztec/stdlib/block';
|
|
21
|
-
import { type L1RollupConstants, getSlotAtTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
21
|
+
import { type L1RollupConstants, getSlotAtTimestamp, getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
22
22
|
import { Gas } from '@aztec/stdlib/gas';
|
|
23
23
|
import {
|
|
24
24
|
type IFullNodeBlockBuilder,
|
|
@@ -43,8 +43,9 @@ import type { GlobalVariableBuilder } from '../global_variable_builder/global_bu
|
|
|
43
43
|
import type { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
44
44
|
import type { Action, InvalidateBlockRequest, SequencerPublisher } from '../publisher/sequencer-publisher.js';
|
|
45
45
|
import type { SequencerConfig } from './config.js';
|
|
46
|
+
import { SequencerInterruptedError, SequencerTooSlowError } from './errors.js';
|
|
46
47
|
import { SequencerMetrics } from './metrics.js';
|
|
47
|
-
import { SequencerTimetable
|
|
48
|
+
import { SequencerTimetable } from './timetable.js';
|
|
48
49
|
import { SequencerState, type SequencerStateWithSlot } from './utils.js';
|
|
49
50
|
|
|
50
51
|
export { SequencerState };
|
|
@@ -221,8 +222,8 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
221
222
|
*/
|
|
222
223
|
public async stop(): Promise<void> {
|
|
223
224
|
this.log.info(`Stopping sequencer`);
|
|
225
|
+
this.setState(SequencerState.STOPPING, undefined, { force: true });
|
|
224
226
|
this.publisher?.interrupt();
|
|
225
|
-
await this.validatorClient?.stop();
|
|
226
227
|
await this.runningPromise?.stop();
|
|
227
228
|
this.setState(SequencerState.STOPPED, undefined, { force: true });
|
|
228
229
|
this.log.info('Stopped sequencer');
|
|
@@ -523,6 +524,10 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
523
524
|
opts?: { force?: boolean },
|
|
524
525
|
): void;
|
|
525
526
|
setState(proposedState: SequencerState, slotNumber: bigint | undefined, opts: { force?: boolean } = {}): void {
|
|
527
|
+
if (this.state === SequencerState.STOPPING && proposedState !== SequencerState.STOPPED && !opts.force) {
|
|
528
|
+
this.log.warn(`Cannot set sequencer to ${proposedState} as it is stopping.`);
|
|
529
|
+
throw new SequencerInterruptedError();
|
|
530
|
+
}
|
|
526
531
|
if (this.state === SequencerState.STOPPED && !opts.force) {
|
|
527
532
|
this.log.warn(`Cannot set sequencer from ${this.state} to ${proposedState} as it is stopped.`);
|
|
528
533
|
return;
|
|
@@ -950,11 +955,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
950
955
|
}
|
|
951
956
|
|
|
952
957
|
private getSlotStartBuildTimestamp(slotNumber: number | bigint): number {
|
|
953
|
-
return (
|
|
954
|
-
Number(this.l1Constants.l1GenesisTime) +
|
|
955
|
-
Number(slotNumber) * this.l1Constants.slotDuration -
|
|
956
|
-
this.l1Constants.ethereumSlotDuration
|
|
957
|
-
);
|
|
958
|
+
return getSlotStartBuildTimestamp(slotNumber, this.l1Constants);
|
|
958
959
|
}
|
|
959
960
|
|
|
960
961
|
private getSecondsIntoSlot(slotNumber: number | bigint): number {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/aztec.js';
|
|
2
2
|
|
|
3
3
|
import { DEFAULT_ATTESTATION_PROPAGATION_TIME } from '../config.js';
|
|
4
|
+
import { SequencerTooSlowError } from './errors.js';
|
|
4
5
|
import type { SequencerMetrics } from './metrics.js';
|
|
5
6
|
import { SequencerState } from './utils.js';
|
|
6
7
|
|
|
@@ -139,6 +140,7 @@ export class SequencerTimetable {
|
|
|
139
140
|
public getMaxAllowedTime(state: SequencerState): number | undefined {
|
|
140
141
|
switch (state) {
|
|
141
142
|
case SequencerState.STOPPED:
|
|
143
|
+
case SequencerState.STOPPING:
|
|
142
144
|
case SequencerState.IDLE:
|
|
143
145
|
case SequencerState.SYNCHRONIZING:
|
|
144
146
|
return; // We don't really care about times for this states
|
|
@@ -177,16 +179,3 @@ export class SequencerTimetable {
|
|
|
177
179
|
this.log.trace(`Enough time to transition to ${newState}`, { maxAllowedTime, secondsIntoSlot });
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
|
-
|
|
181
|
-
export class SequencerTooSlowError extends Error {
|
|
182
|
-
constructor(
|
|
183
|
-
public readonly proposedState: SequencerState,
|
|
184
|
-
public readonly maxAllowedTime: number,
|
|
185
|
-
public readonly currentTime: number,
|
|
186
|
-
) {
|
|
187
|
-
super(
|
|
188
|
-
`Too far into slot for ${proposedState} (time into slot ${currentTime}s greater than ${maxAllowedTime}s allowance)`,
|
|
189
|
-
);
|
|
190
|
-
this.name = 'SequencerTooSlowError';
|
|
191
|
-
}
|
|
192
|
-
}
|
package/src/sequencer/utils.ts
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
export enum SequencerState {
|
|
2
|
-
/**
|
|
3
|
-
* Sequencer is stopped and not processing any txs from the pool.
|
|
4
|
-
*/
|
|
2
|
+
/** Sequencer is stopped and not processing any txs from the pool. */
|
|
5
3
|
STOPPED = 'STOPPED',
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/** Sequencer is being stopped. Will move to STOPPED shortly. */
|
|
5
|
+
STOPPING = 'STOPPING',
|
|
6
|
+
/** Sequencer is awaiting the next call to work(). */
|
|
9
7
|
IDLE = 'IDLE',
|
|
10
|
-
/**
|
|
11
|
-
* Synchronizing with the L2 chain.
|
|
12
|
-
*/
|
|
8
|
+
/** Synchronizing with the L2 chain. */
|
|
13
9
|
SYNCHRONIZING = 'SYNCHRONIZING',
|
|
14
|
-
/**
|
|
15
|
-
* Checking if we are the proposer for the current slot.
|
|
16
|
-
*/
|
|
10
|
+
/** Checking if we are the proposer for the current slot. */
|
|
17
11
|
PROPOSER_CHECK = 'PROPOSER_CHECK',
|
|
18
|
-
/**
|
|
19
|
-
* Initializing the block proposal. Will move to CREATING_BLOCK if there are valid txs to include, or back to SYNCHRONIZING otherwise.
|
|
20
|
-
*/
|
|
12
|
+
/** Initializing the block proposal. Will move to CREATING_BLOCK if there are valid txs to include, or back to SYNCHRONIZING otherwise. */
|
|
21
13
|
INITIALIZING_PROPOSAL = 'INITIALIZING_PROPOSAL',
|
|
22
|
-
/**
|
|
23
|
-
* Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA.
|
|
24
|
-
*/
|
|
14
|
+
/** Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA. */
|
|
25
15
|
CREATING_BLOCK = 'CREATING_BLOCK',
|
|
26
|
-
/**
|
|
27
|
-
* Collecting attestations from its peers. Will move to PUBLISHING_BLOCK.
|
|
28
|
-
*/
|
|
16
|
+
/** Collecting attestations from its peers. Will move to PUBLISHING_BLOCK. */
|
|
29
17
|
COLLECTING_ATTESTATIONS = 'COLLECTING_ATTESTATIONS',
|
|
30
|
-
/**
|
|
31
|
-
* Sending the tx to L1 with the L2 block data and awaiting it to be mined. Will move to SYNCHRONIZING.
|
|
32
|
-
*/
|
|
18
|
+
/** Sending the tx to L1 with the L2 block data and awaiting it to be mined. Will move to SYNCHRONIZING. */
|
|
33
19
|
PUBLISHING_BLOCK = 'PUBLISHING_BLOCK',
|
|
34
20
|
}
|
|
35
21
|
|