@aztec/sequencer-client 0.0.1-commit.c31f2472 → 0.0.1-commit.c52d6e7
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/README.md +281 -21
- package/dest/client/sequencer-client.d.ts +34 -11
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +77 -39
- package/dest/config.d.ts +33 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +100 -46
- package/dest/global_variable_builder/fee_predictor.d.ts +37 -0
- package/dest/global_variable_builder/fee_predictor.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_predictor.js +138 -0
- package/dest/global_variable_builder/fee_provider.d.ts +21 -0
- package/dest/global_variable_builder/fee_provider.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_provider.js +80 -0
- package/dest/global_variable_builder/global_builder.d.ts +13 -28
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +9 -66
- package/dest/global_variable_builder/index.d.ts +4 -2
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/global_variable_builder/index.js +2 -0
- package/dest/publisher/config.d.ts +51 -17
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +131 -42
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/l1_to_l2_messaging.d.ts +21 -0
- package/dest/publisher/l1_to_l2_messaging.d.ts.map +1 -0
- package/dest/publisher/l1_to_l2_messaging.js +70 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +98 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +68 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +36 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/index.js +3 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts +96 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts.map +1 -0
- package/dest/publisher/sequencer-bundle-simulator.js +198 -0
- 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 +27 -3
- package/dest/publisher/sequencer-publisher.d.ts +123 -68
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +775 -364
- package/dest/publisher/write_json.d.ts +11 -0
- package/dest/publisher/write_json.d.ts.map +1 -0
- package/dest/publisher/write_json.js +57 -0
- package/dest/sequencer/automine/automine_factory.d.ts +56 -0
- package/dest/sequencer/automine/automine_factory.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_factory.js +85 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts +189 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_sequencer.js +696 -0
- package/dest/sequencer/automine/index.d.ts +3 -0
- package/dest/sequencer/automine/index.d.ts.map +1 -0
- package/dest/sequencer/automine/index.js +2 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +99 -20
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +926 -286
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts +34 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.js +72 -0
- 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 +62 -5
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/metrics.d.ts +23 -8
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +117 -21
- package/dest/sequencer/missing_committee.d.ts +72 -0
- package/dest/sequencer/missing_committee.d.ts.map +1 -0
- package/dest/sequencer/missing_committee.js +139 -0
- package/dest/sequencer/requests_tracker.d.ts +22 -0
- package/dest/sequencer/requests_tracker.d.ts.map +1 -0
- package/dest/sequencer/requests_tracker.js +33 -0
- package/dest/sequencer/sequencer.d.ts +182 -44
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +623 -216
- package/dest/sequencer/types.d.ts +2 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/index.d.ts +5 -7
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +12 -12
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +45 -36
- package/dest/test/utils.d.ts +17 -3
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +28 -9
- package/package.json +29 -29
- package/src/client/sequencer-client.ts +110 -47
- package/src/config.ts +127 -55
- package/src/global_variable_builder/README.md +44 -0
- package/src/global_variable_builder/fee_predictor.ts +182 -0
- package/src/global_variable_builder/fee_provider.ts +97 -0
- package/src/global_variable_builder/global_builder.ts +20 -89
- package/src/global_variable_builder/index.ts +3 -1
- package/src/publisher/config.ts +173 -40
- package/src/publisher/index.ts +3 -0
- package/src/publisher/l1_to_l2_messaging.ts +85 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +164 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +47 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-bundle-simulator.ts +254 -0
- package/src/publisher/sequencer-publisher-factory.ts +38 -9
- package/src/publisher/sequencer-publisher.ts +885 -461
- package/src/publisher/write_json.ts +78 -0
- package/src/sequencer/README.md +162 -450
- package/src/sequencer/automine/README.md +60 -0
- package/src/sequencer/automine/automine_factory.ts +152 -0
- package/src/sequencer/automine/automine_sequencer.ts +800 -0
- package/src/sequencer/automine/index.ts +6 -0
- package/src/sequencer/checkpoint_proposal_job.ts +1131 -325
- package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
- package/src/sequencer/checkpoint_voter.ts +1 -12
- package/src/sequencer/events.ts +66 -5
- package/src/sequencer/metrics.ts +132 -25
- package/src/sequencer/missing_committee.ts +192 -0
- package/src/sequencer/requests_tracker.ts +43 -0
- package/src/sequencer/sequencer.ts +737 -241
- package/src/sequencer/types.ts +1 -1
- package/src/test/index.ts +4 -6
- package/src/test/mock_checkpoint_builder.ts +65 -53
- package/src/test/utils.ts +64 -10
- package/dest/sequencer/timetable.d.ts +0 -90
- package/dest/sequencer/timetable.d.ts.map +0 -1
- package/dest/sequencer/timetable.js +0 -226
- package/src/sequencer/timetable.ts +0 -282
|
@@ -3,50 +3,104 @@ import { Blob, getBlobsPerL1Block, getPrefixedEthBlobCommitments } from '@aztec/
|
|
|
3
3
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
4
4
|
import type { L1ContractsConfig } from '@aztec/ethereum/config';
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
FeeAssetPriceOracle,
|
|
7
7
|
type GovernanceProposerContract,
|
|
8
|
-
type IEmpireBase,
|
|
9
8
|
MULTI_CALL_3_ADDRESS,
|
|
10
9
|
Multicall3,
|
|
11
|
-
|
|
12
|
-
type
|
|
13
|
-
type
|
|
14
|
-
type
|
|
10
|
+
MulticallForwarderRevertedError,
|
|
11
|
+
type PayloadProposalStatus,
|
|
12
|
+
type RollupContract,
|
|
13
|
+
type SimulationOverridesPlan,
|
|
14
|
+
type SlashingProposerContract,
|
|
15
|
+
buildSimulationOverridesStateOverride,
|
|
15
16
|
} from '@aztec/ethereum/contracts';
|
|
16
|
-
import { type L1FeeAnalysisResult, L1FeeAnalyzer } from '@aztec/ethereum/l1-fee-analysis';
|
|
17
|
+
import { type L1FeeAnalysisResult, L1FeeAnalyzer, captureWindowBlockFees } from '@aztec/ethereum/l1-fee-analysis';
|
|
17
18
|
import {
|
|
18
19
|
type L1BlobInputs,
|
|
19
20
|
type L1TxConfig,
|
|
20
21
|
type L1TxRequest,
|
|
22
|
+
L1TxTimeoutError,
|
|
23
|
+
type L1TxUtils,
|
|
24
|
+
MAX_L1_TX_LIMIT,
|
|
21
25
|
type TransactionStats,
|
|
22
26
|
WEI_CONST,
|
|
23
27
|
} from '@aztec/ethereum/l1-tx-utils';
|
|
24
|
-
import
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
import {
|
|
29
|
+
FormattedViemError,
|
|
30
|
+
formatViemError,
|
|
31
|
+
mergeAbis,
|
|
32
|
+
tryDecodeRevertReason,
|
|
33
|
+
tryExtractEvent,
|
|
34
|
+
} from '@aztec/ethereum/utils';
|
|
28
35
|
import { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
36
|
+
import { trimmedBytesLength } from '@aztec/foundation/buffer';
|
|
29
37
|
import { pick } from '@aztec/foundation/collection';
|
|
30
38
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
39
|
+
import { TimeoutError } from '@aztec/foundation/error';
|
|
31
40
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
32
|
-
import { Signature
|
|
41
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
33
42
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
43
|
+
import { InterruptibleSleep } from '@aztec/foundation/sleep';
|
|
34
44
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
35
|
-
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
36
|
-
import { EmpireBaseAbi, ErrorsAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
45
|
+
import { type DateProvider, Timer } from '@aztec/foundation/timer';
|
|
46
|
+
import { EmpireBaseAbi, ErrorsAbi, RollupAbi, SlashingProposerAbi } from '@aztec/l1-artifacts';
|
|
37
47
|
import { type ProposerSlashAction, encodeSlashConsensusVotes } from '@aztec/slasher';
|
|
38
48
|
import { CommitteeAttestationsAndSigners, type ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
39
49
|
import type { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
40
|
-
import {
|
|
50
|
+
import type { SequencerConfig } from '@aztec/stdlib/config';
|
|
51
|
+
import {
|
|
52
|
+
getLastL1SlotTimestampForL2Slot,
|
|
53
|
+
getNextL1SlotTimestamp,
|
|
54
|
+
getTimestampForSlot,
|
|
55
|
+
} from '@aztec/stdlib/epoch-helpers';
|
|
41
56
|
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
42
57
|
import type { L1PublishCheckpointStats } from '@aztec/stdlib/stats';
|
|
43
58
|
import { type TelemetryClient, type Tracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
44
59
|
|
|
45
|
-
import {
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
import {
|
|
61
|
+
type Abi,
|
|
62
|
+
type Hex,
|
|
63
|
+
type TransactionReceipt,
|
|
64
|
+
type TypedDataDefinition,
|
|
65
|
+
encodeFunctionData,
|
|
66
|
+
keccak256,
|
|
67
|
+
toHex,
|
|
68
|
+
} from 'viem';
|
|
69
|
+
|
|
70
|
+
import type { SequencerPublisherConfig } from './config.js';
|
|
71
|
+
import { type FailedL1Tx, type L1TxFailedStore, createL1TxFailedStore } from './l1_tx_failed_store/index.js';
|
|
72
|
+
import { type DroppedRequest, SequencerBundleSimulator } from './sequencer-bundle-simulator.js';
|
|
48
73
|
import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
49
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Returns true if the receipt indicates a successful send AND the expected event was emitted
|
|
77
|
+
* by the target contract. Both pieces are required: an aggregate3 entry that reverted will
|
|
78
|
+
* have receipt.status === 'success' but no event log.
|
|
79
|
+
*/
|
|
80
|
+
function extractEventSuccess(
|
|
81
|
+
receipt: TransactionReceipt | undefined,
|
|
82
|
+
opts: { address: string; abi: Abi; eventName: string },
|
|
83
|
+
): boolean {
|
|
84
|
+
if (!receipt || receipt.status !== 'success') {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
return !!tryExtractEvent(receipt.logs, opts.address.toString() as Hex, opts.abi, opts.eventName);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Result of a sendRequests call, returned by both sendRequests() and sendRequestsAt(). */
|
|
91
|
+
export type SendRequestsResult = {
|
|
92
|
+
/** The L1 transaction receipt from the bundled multicall. */
|
|
93
|
+
result: { receipt: TransactionReceipt };
|
|
94
|
+
/** Actions that expired (past their deadline) before the request was sent. */
|
|
95
|
+
expiredActions: Action[];
|
|
96
|
+
/** Actions that were included in the sent L1 transaction. */
|
|
97
|
+
sentActions: Action[];
|
|
98
|
+
/** Actions whose L1 simulation succeeded (subset of sentActions). */
|
|
99
|
+
successfulActions: Action[];
|
|
100
|
+
/** Actions whose L1 simulation failed (subset of sentActions). */
|
|
101
|
+
failedActions: Action[];
|
|
102
|
+
};
|
|
103
|
+
|
|
50
104
|
/** Arguments to the process method of the rollup contract */
|
|
51
105
|
type L1ProcessArgs = {
|
|
52
106
|
/** The L2 block header. */
|
|
@@ -59,23 +113,23 @@ type L1ProcessArgs = {
|
|
|
59
113
|
attestationsAndSigners: CommitteeAttestationsAndSigners;
|
|
60
114
|
/** Attestations and signers signature */
|
|
61
115
|
attestationsAndSignersSignature: Signature;
|
|
116
|
+
/** The fee asset price modifier in basis points (from oracle) */
|
|
117
|
+
feeAssetPriceModifier: bigint;
|
|
62
118
|
};
|
|
63
119
|
|
|
64
120
|
export const Actions = [
|
|
65
121
|
'invalidate-by-invalid-attestation',
|
|
66
122
|
'invalidate-by-insufficient-attestations',
|
|
123
|
+
'prune',
|
|
67
124
|
'propose',
|
|
68
125
|
'governance-signal',
|
|
69
|
-
'empire-slashing-signal',
|
|
70
|
-
'create-empire-payload',
|
|
71
|
-
'execute-empire-payload',
|
|
72
126
|
'vote-offenses',
|
|
73
127
|
'execute-slash',
|
|
74
128
|
] as const;
|
|
75
129
|
|
|
76
130
|
export type Action = (typeof Actions)[number];
|
|
77
131
|
|
|
78
|
-
type GovernanceSignalAction = Extract<Action, 'governance-signal'
|
|
132
|
+
type GovernanceSignalAction = Extract<Action, 'governance-signal'>;
|
|
79
133
|
|
|
80
134
|
// Sorting for actions such that invalidations go before proposals, and proposals go before votes
|
|
81
135
|
export const compareActions = (a: Action, b: Action) => Actions.indexOf(a) - Actions.indexOf(b);
|
|
@@ -86,14 +140,22 @@ export type InvalidateCheckpointRequest = {
|
|
|
86
140
|
gasUsed: bigint;
|
|
87
141
|
checkpointNumber: CheckpointNumber;
|
|
88
142
|
forcePendingCheckpointNumber: CheckpointNumber;
|
|
143
|
+
/** Archive at the rollback target checkpoint (checkpoint N-1). */
|
|
144
|
+
lastArchive: Fr;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
type EnqueueProposeCheckpointOpts = {
|
|
148
|
+
txTimeoutAt?: Date;
|
|
89
149
|
};
|
|
90
150
|
|
|
91
|
-
interface RequestWithExpiry {
|
|
151
|
+
export interface RequestWithExpiry {
|
|
92
152
|
action: Action;
|
|
93
153
|
request: L1TxRequest;
|
|
94
154
|
lastValidL2Slot: SlotNumber;
|
|
95
155
|
gasConfig?: Pick<L1TxConfig, 'txTimeoutAt' | 'gasLimit'>;
|
|
96
156
|
blobConfig?: L1BlobInputs;
|
|
157
|
+
/** Gas consumed by validateBlobs; stashed for the bundle simulate at send time. */
|
|
158
|
+
blobEvaluationGas?: bigint;
|
|
97
159
|
checkSuccess: (
|
|
98
160
|
request: L1TxRequest,
|
|
99
161
|
result?: { receipt: TransactionReceipt; stats?: TransactionStats; errorMsg?: string },
|
|
@@ -103,74 +165,93 @@ interface RequestWithExpiry {
|
|
|
103
165
|
export class SequencerPublisher {
|
|
104
166
|
private interrupted = false;
|
|
105
167
|
private metrics: SequencerPublisherMetrics;
|
|
168
|
+
private bundleSimulator: SequencerBundleSimulator;
|
|
106
169
|
public epochCache: EpochCache;
|
|
170
|
+
private failedTxStore?: Promise<L1TxFailedStore | undefined>;
|
|
107
171
|
|
|
108
|
-
|
|
109
|
-
|
|
172
|
+
/**
|
|
173
|
+
* ABI used to decode raw revert payloads from dropped bundle entries when the original
|
|
174
|
+
* request did not carry an abi (e.g. the propose request). Merges every contract the
|
|
175
|
+
* publisher can route to so any of their custom errors decode against it.
|
|
176
|
+
*/
|
|
177
|
+
private readonly revertDecoderAbi: Abi = mergeAbis([RollupAbi, SlashingProposerAbi, EmpireBaseAbi, ErrorsAbi]);
|
|
110
178
|
|
|
111
179
|
protected lastActions: Partial<Record<Action, SlotNumber>> = {};
|
|
112
180
|
|
|
113
|
-
private isPayloadEmptyCache: Map<string, boolean> = new Map<string, boolean>();
|
|
114
|
-
|
|
115
181
|
protected log: Logger;
|
|
116
182
|
protected ethereumSlotDuration: bigint;
|
|
183
|
+
protected aztecSlotDuration: bigint;
|
|
184
|
+
private readonly previousL1BlockWaitTimeoutMs: number;
|
|
185
|
+
private readonly previousL1BlockWaitPollIntervalMs: number;
|
|
186
|
+
|
|
187
|
+
/** Date provider for wall-clock time. */
|
|
188
|
+
private readonly dateProvider: DateProvider;
|
|
117
189
|
|
|
118
190
|
private blobClient: BlobClientInterface;
|
|
119
191
|
|
|
120
|
-
/**
|
|
121
|
-
private
|
|
192
|
+
/** Optional callback to obtain a replacement publisher when the current one fails to send. */
|
|
193
|
+
private getNextPublisher?: (excludeAddresses: EthAddress[]) => Promise<L1TxUtils | undefined>;
|
|
122
194
|
|
|
123
195
|
/** L1 fee analyzer for fisherman mode */
|
|
124
196
|
private l1FeeAnalyzer?: L1FeeAnalyzer;
|
|
125
|
-
// @note - with blobs, the below estimate seems too large.
|
|
126
|
-
// Total used for full block from int_l1_pub e2e test: 1m (of which 86k is 1x blob)
|
|
127
|
-
// Total used for emptier block from above test: 429k (of which 84k is 1x blob)
|
|
128
|
-
public static PROPOSE_GAS_GUESS: bigint = 12_000_000n;
|
|
129
197
|
|
|
130
|
-
|
|
131
|
-
|
|
198
|
+
/** Fee asset price oracle for computing price modifiers from Uniswap V4 */
|
|
199
|
+
private feeAssetPriceOracle: FeeAssetPriceOracle;
|
|
132
200
|
|
|
133
|
-
|
|
134
|
-
|
|
201
|
+
/** Interruptible sleep used by sendRequestsAt to wait until a target timestamp. */
|
|
202
|
+
private readonly interruptibleSleep = new InterruptibleSleep();
|
|
135
203
|
|
|
136
|
-
public l1TxUtils:
|
|
204
|
+
public l1TxUtils: L1TxUtils;
|
|
137
205
|
public rollupContract: RollupContract;
|
|
138
206
|
public govProposerContract: GovernanceProposerContract;
|
|
139
|
-
public slashingProposerContract:
|
|
140
|
-
public slashFactoryContract: SlashFactoryContract;
|
|
207
|
+
public slashingProposerContract: SlashingProposerContract | undefined;
|
|
141
208
|
|
|
142
209
|
public readonly tracer: Tracer;
|
|
143
210
|
|
|
144
211
|
protected requests: RequestWithExpiry[] = [];
|
|
145
212
|
|
|
146
213
|
constructor(
|
|
147
|
-
private config:
|
|
214
|
+
private config: Pick<
|
|
215
|
+
SequencerPublisherConfig,
|
|
216
|
+
| 'fishermanMode'
|
|
217
|
+
| 'l1TxFailedStore'
|
|
218
|
+
| 'sequencerPublisherPreviousL1BlockWaitTimeoutMs'
|
|
219
|
+
| 'sequencerPublisherPreviousL1BlockWaitPollIntervalMs'
|
|
220
|
+
> &
|
|
221
|
+
Pick<SequencerConfig, 'governanceProposerForcePayloadVote'> &
|
|
222
|
+
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration'> & { l1ChainId: number },
|
|
148
223
|
deps: {
|
|
149
224
|
telemetry?: TelemetryClient;
|
|
150
225
|
blobClient: BlobClientInterface;
|
|
151
|
-
l1TxUtils:
|
|
226
|
+
l1TxUtils: L1TxUtils;
|
|
152
227
|
rollupContract: RollupContract;
|
|
153
|
-
slashingProposerContract:
|
|
228
|
+
slashingProposerContract: SlashingProposerContract | undefined;
|
|
154
229
|
governanceProposerContract: GovernanceProposerContract;
|
|
155
|
-
slashFactoryContract: SlashFactoryContract;
|
|
156
230
|
epochCache: EpochCache;
|
|
157
231
|
dateProvider: DateProvider;
|
|
158
232
|
metrics: SequencerPublisherMetrics;
|
|
159
233
|
lastActions: Partial<Record<Action, SlotNumber>>;
|
|
160
234
|
log?: Logger;
|
|
235
|
+
getNextPublisher?: (excludeAddresses: EthAddress[]) => Promise<L1TxUtils | undefined>;
|
|
161
236
|
},
|
|
162
237
|
) {
|
|
163
238
|
this.log = deps.log ?? createLogger('sequencer:publisher');
|
|
164
239
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
240
|
+
this.aztecSlotDuration = BigInt(config.aztecSlotDuration);
|
|
241
|
+
this.previousL1BlockWaitTimeoutMs = config.sequencerPublisherPreviousL1BlockWaitTimeoutMs;
|
|
242
|
+
this.previousL1BlockWaitPollIntervalMs = config.sequencerPublisherPreviousL1BlockWaitPollIntervalMs;
|
|
243
|
+
this.dateProvider = deps.dateProvider;
|
|
165
244
|
this.epochCache = deps.epochCache;
|
|
166
245
|
this.lastActions = deps.lastActions;
|
|
167
246
|
|
|
168
247
|
this.blobClient = deps.blobClient;
|
|
248
|
+
this.dateProvider = deps.dateProvider;
|
|
169
249
|
|
|
170
250
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
171
251
|
this.metrics = deps.metrics ?? new SequencerPublisherMetrics(telemetry, 'SequencerPublisher');
|
|
172
252
|
this.tracer = telemetry.getTracer('SequencerPublisher');
|
|
173
253
|
this.l1TxUtils = deps.l1TxUtils;
|
|
254
|
+
this.getNextPublisher = deps.getNextPublisher;
|
|
174
255
|
|
|
175
256
|
this.rollupContract = deps.rollupContract;
|
|
176
257
|
|
|
@@ -182,22 +263,143 @@ export class SequencerPublisher {
|
|
|
182
263
|
const newSlashingProposer = await this.rollupContract.getSlashingProposer();
|
|
183
264
|
this.slashingProposerContract = newSlashingProposer;
|
|
184
265
|
});
|
|
185
|
-
this.slashFactoryContract = deps.slashFactoryContract;
|
|
186
|
-
|
|
187
266
|
// Initialize L1 fee analyzer for fisherman mode
|
|
188
267
|
if (config.fishermanMode) {
|
|
189
268
|
this.l1FeeAnalyzer = new L1FeeAnalyzer(
|
|
190
269
|
this.l1TxUtils.client,
|
|
191
270
|
deps.dateProvider,
|
|
192
|
-
|
|
271
|
+
this.log.createChild('fee-analyzer'),
|
|
193
272
|
);
|
|
194
273
|
}
|
|
274
|
+
|
|
275
|
+
// Initialize fee asset price oracle
|
|
276
|
+
this.feeAssetPriceOracle = new FeeAssetPriceOracle(
|
|
277
|
+
this.l1TxUtils.client,
|
|
278
|
+
this.rollupContract,
|
|
279
|
+
this.log.createChild('price-oracle'),
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
// Initialize failed L1 tx store (optional, for test networks)
|
|
283
|
+
this.failedTxStore = createL1TxFailedStore(config.l1TxFailedStore, this.log);
|
|
284
|
+
|
|
285
|
+
this.bundleSimulator = new SequencerBundleSimulator({
|
|
286
|
+
getL1TxUtils: () => this.l1TxUtils,
|
|
287
|
+
rollupContract: this.rollupContract,
|
|
288
|
+
epochCache: this.epochCache,
|
|
289
|
+
log: this.log.createChild('bundle-simulator'),
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Logs the gas-pricing data of a failed L1 transaction at warn — so underpricing is diagnosable
|
|
295
|
+
* from logs even with no failed-tx store configured — and backs the record up to the store when
|
|
296
|
+
* one is. When captureFeeSummary is true, also records the fee data of the already-mined L1
|
|
297
|
+
* blocks in the target slot's inclusion window.
|
|
298
|
+
*/
|
|
299
|
+
private backupFailedTx(
|
|
300
|
+
failedTx: Omit<FailedL1Tx, 'timestamp'>,
|
|
301
|
+
opts?: { captureFeeSummary?: boolean; targetSlot?: SlotNumber; sharedFeeSummary?: FailedL1Tx['gasInfo'] },
|
|
302
|
+
): void {
|
|
303
|
+
const tx: FailedL1Tx = {
|
|
304
|
+
...failedTx,
|
|
305
|
+
timestamp: Date.now(),
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
// Fire and forget - don't block on backup
|
|
309
|
+
void (async () => {
|
|
310
|
+
try {
|
|
311
|
+
// Prefer a pre-captured summary (shared across a batch of failures in the same slot) so we
|
|
312
|
+
// don't re-read the fee window per record. A capture error must not lose the record itself.
|
|
313
|
+
const feeSummary =
|
|
314
|
+
opts?.sharedFeeSummary ??
|
|
315
|
+
(opts?.captureFeeSummary
|
|
316
|
+
? await this.captureFeeEnvironment(opts.targetSlot).catch(() => undefined)
|
|
317
|
+
: undefined);
|
|
318
|
+
if (feeSummary) {
|
|
319
|
+
tx.gasInfo = { ...tx.gasInfo, ...feeSummary };
|
|
320
|
+
}
|
|
321
|
+
if (tx.gasInfo) {
|
|
322
|
+
this.log.warn(`Gas pricing data for failed L1 tx (${tx.failureType})`, {
|
|
323
|
+
failureType: tx.failureType,
|
|
324
|
+
actions: tx.context.actions,
|
|
325
|
+
slot: tx.context.slot,
|
|
326
|
+
...tx.gasInfo,
|
|
327
|
+
...tx.timing,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
const store = await this.failedTxStore;
|
|
331
|
+
if (store) {
|
|
332
|
+
await store.saveFailedTx(tx);
|
|
333
|
+
}
|
|
334
|
+
} catch (err) {
|
|
335
|
+
this.log.warn(`Failed to backup failed L1 tx to store`, err);
|
|
336
|
+
}
|
|
337
|
+
})();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Captures per-block fee data for the L1 blocks in the target slot's inclusion window (the blocks the
|
|
342
|
+
* tx could have landed in) for underpricing diagnostics. Reads only already-mined blocks, so it never
|
|
343
|
+
* waits on the chain. Safe to call off the critical path: the underlying capture never throws, and this
|
|
344
|
+
* returns undefined when there is no target slot or the window is not yet mined (e.g. an early send
|
|
345
|
+
* failure), in which case the record simply carries no window data.
|
|
346
|
+
*/
|
|
347
|
+
private async captureFeeEnvironment(targetL2Slot: SlotNumber | undefined): Promise<FailedL1Tx['gasInfo']> {
|
|
348
|
+
if (targetL2Slot === undefined) {
|
|
349
|
+
return undefined;
|
|
350
|
+
}
|
|
351
|
+
const l1Constants = this.epochCache.getL1Constants();
|
|
352
|
+
// The inclusion window is [start of slot N, start of slot N+1): all L1 blocks that can include a tx
|
|
353
|
+
// for this L2 slot. getTimestampForSlot returns seconds, matching block.timestamp.
|
|
354
|
+
const windowStartS = getTimestampForSlot(targetL2Slot, l1Constants);
|
|
355
|
+
const windowEndS = getTimestampForSlot(SlotNumber(Number(targetL2Slot) + 1), l1Constants);
|
|
356
|
+
const windowBlocks = await captureWindowBlockFees(this.l1TxUtils.client, windowStartS, windowEndS);
|
|
357
|
+
if (windowBlocks.length === 0) {
|
|
358
|
+
return undefined;
|
|
359
|
+
}
|
|
360
|
+
return { windowBlocks };
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** Computes timing info relative to the L2 slot deadline. */
|
|
364
|
+
private computeTimingInfo(targetL2Slot: SlotNumber | undefined): FailedL1Tx['timing'] {
|
|
365
|
+
if (targetL2Slot === undefined) {
|
|
366
|
+
return undefined;
|
|
367
|
+
}
|
|
368
|
+
const l1Constants = this.epochCache.getL1Constants();
|
|
369
|
+
const slotDeadlineS = getTimestampForSlot(SlotNumber(Number(targetL2Slot) + 1), l1Constants);
|
|
370
|
+
const slotDeadlineMs = Number(slotDeadlineS) * 1000;
|
|
371
|
+
return {
|
|
372
|
+
targetL2Slot: Number(targetL2Slot),
|
|
373
|
+
slotDeadlineTimestampS: slotDeadlineS,
|
|
374
|
+
msUntilSlotDeadline: slotDeadlineMs - this.dateProvider.now(),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Builds an id for a synthetic failure record (send-error/timeout) that has no on-chain tx hash.
|
|
380
|
+
* Includes the failure time so each attempt — including retries of the same slot — is stored as its
|
|
381
|
+
* own record rather than overwriting the previous one.
|
|
382
|
+
*/
|
|
383
|
+
private failureRecordId(actions: string[], targetSlot: SlotNumber | undefined): Hex {
|
|
384
|
+
return keccak256(toHex(`${actions.join(',')}:${targetSlot ?? ''}:${Date.now()}`));
|
|
195
385
|
}
|
|
196
386
|
|
|
197
387
|
public getRollupContract(): RollupContract {
|
|
198
388
|
return this.rollupContract;
|
|
199
389
|
}
|
|
200
390
|
|
|
391
|
+
/**
|
|
392
|
+
* Gets the fee asset price modifier from the oracle.
|
|
393
|
+
*
|
|
394
|
+
* @param predictedParentEthPerFeeAssetE12 - Optional predicted parent eth-per-fee-asset (E12).
|
|
395
|
+
* Pipelined proposers should pass the value from the predicted parent fee header so the
|
|
396
|
+
* modifier matches the parent L1 will use when applying it.
|
|
397
|
+
* @returns The fee asset price modifier in basis points, or 0n if the oracle query fails.
|
|
398
|
+
*/
|
|
399
|
+
public getFeeAssetPriceModifier(predictedParentEthPerFeeAssetE12?: bigint): Promise<bigint> {
|
|
400
|
+
return this.feeAssetPriceOracle.computePriceModifier(predictedParentEthPerFeeAssetE12);
|
|
401
|
+
}
|
|
402
|
+
|
|
201
403
|
public getSenderAddress() {
|
|
202
404
|
return this.l1TxUtils.getSenderAddress();
|
|
203
405
|
}
|
|
@@ -209,20 +411,12 @@ export class SequencerPublisher {
|
|
|
209
411
|
return this.l1FeeAnalyzer;
|
|
210
412
|
}
|
|
211
413
|
|
|
212
|
-
/**
|
|
213
|
-
* Sets the proposer address to use for simulations in fisherman mode.
|
|
214
|
-
* @param proposerAddress - The actual proposer's address to use for balance lookups in simulations
|
|
215
|
-
*/
|
|
216
|
-
public setProposerAddressForSimulation(proposerAddress: EthAddress | undefined) {
|
|
217
|
-
this.proposerAddressForSimulation = proposerAddress;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
414
|
public addRequest(request: RequestWithExpiry) {
|
|
221
415
|
this.requests.push(request);
|
|
222
416
|
}
|
|
223
417
|
|
|
224
418
|
public getCurrentL2Slot(): SlotNumber {
|
|
225
|
-
return this.epochCache.
|
|
419
|
+
return this.epochCache.getSlotNow();
|
|
226
420
|
}
|
|
227
421
|
|
|
228
422
|
/**
|
|
@@ -273,7 +467,7 @@ export class SequencerPublisher {
|
|
|
273
467
|
// Start the analysis
|
|
274
468
|
const analysisId = await this.l1FeeAnalyzer.startAnalysis(
|
|
275
469
|
l2SlotNumber,
|
|
276
|
-
gasLimit > 0n ? gasLimit :
|
|
470
|
+
gasLimit > 0n ? gasLimit : MAX_L1_TX_LIMIT,
|
|
277
471
|
l1Requests,
|
|
278
472
|
blobConfig,
|
|
279
473
|
onComplete,
|
|
@@ -294,22 +488,26 @@ export class SequencerPublisher {
|
|
|
294
488
|
|
|
295
489
|
/**
|
|
296
490
|
* Sends all requests that are still valid.
|
|
491
|
+
* @param targetSlot - The target L2 slot for this send. When provided (the production path, via
|
|
492
|
+
* sendRequestsAt), it is threaded into bundleSimulate so the block.timestamp override matches
|
|
493
|
+
* the slot the propose is built for. When omitted, falls back to getCurrentL2Slot() for the
|
|
494
|
+
* AutomineSequencer, which publishes synchronously within the current slot.
|
|
297
495
|
* @returns one of:
|
|
298
496
|
* - A receipt and stats if the tx succeeded
|
|
299
497
|
* - a receipt and errorMsg if it failed on L1
|
|
300
498
|
* - undefined if no valid requests are found OR the tx failed to send.
|
|
301
499
|
*/
|
|
302
500
|
@trackSpan('SequencerPublisher.sendRequests')
|
|
303
|
-
public async sendRequests() {
|
|
501
|
+
public async sendRequests(targetSlot?: SlotNumber): Promise<SendRequestsResult | undefined> {
|
|
304
502
|
const requestsToProcess = [...this.requests];
|
|
305
503
|
this.requests = [];
|
|
504
|
+
|
|
306
505
|
if (this.interrupted || requestsToProcess.length === 0) {
|
|
307
506
|
return undefined;
|
|
308
507
|
}
|
|
309
|
-
const currentL2Slot = this.getCurrentL2Slot();
|
|
508
|
+
const currentL2Slot = targetSlot ?? this.getCurrentL2Slot();
|
|
310
509
|
this.log.debug(`Sending requests on L2 slot ${currentL2Slot}`);
|
|
311
510
|
const validRequests = requestsToProcess.filter(request => request.lastValidL2Slot >= currentL2Slot);
|
|
312
|
-
const validActions = validRequests.map(x => x.action);
|
|
313
511
|
const expiredActions = requestsToProcess
|
|
314
512
|
.filter(request => request.lastValidL2Slot < currentL2Slot)
|
|
315
513
|
.map(x => x.action);
|
|
@@ -332,47 +530,101 @@ export class SequencerPublisher {
|
|
|
332
530
|
return undefined;
|
|
333
531
|
}
|
|
334
532
|
|
|
335
|
-
//
|
|
336
|
-
|
|
337
|
-
// See https://github.com/AztecProtocol/aztec-packages/issues/11513
|
|
338
|
-
const gasConfigs = requestsToProcess.filter(request => request.gasConfig).map(request => request.gasConfig);
|
|
339
|
-
const blobConfigs = requestsToProcess.filter(request => request.blobConfig).map(request => request.blobConfig);
|
|
340
|
-
|
|
341
|
-
if (blobConfigs.length > 1) {
|
|
342
|
-
throw new Error('Multiple blob configs found');
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
const blobConfig = blobConfigs[0];
|
|
346
|
-
|
|
347
|
-
// Merge gasConfigs. Yields the sum of gasLimits, and the earliest txTimeoutAt, or undefined if no gasConfig sets them.
|
|
348
|
-
const gasLimits = gasConfigs.map(g => g?.gasLimit).filter((g): g is bigint => g !== undefined);
|
|
349
|
-
const gasLimit = gasLimits.length > 0 ? sumBigint(gasLimits) : undefined; // sum
|
|
533
|
+
// Collect earliest txTimeoutAt across all requests.
|
|
534
|
+
const gasConfigs = validRequests.filter(request => request.gasConfig).map(request => request.gasConfig);
|
|
350
535
|
const txTimeoutAts = gasConfigs.map(g => g?.txTimeoutAt).filter((g): g is Date => g !== undefined);
|
|
351
|
-
const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map(g => g.getTime()))) : undefined;
|
|
352
|
-
const txConfig: RequestWithExpiry['gasConfig'] = { gasLimit, txTimeoutAt };
|
|
536
|
+
const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map(g => g.getTime()))) : undefined;
|
|
353
537
|
|
|
354
538
|
// Sort the requests so that proposals always go first
|
|
355
539
|
// This ensures the committee gets precomputed correctly
|
|
356
540
|
validRequests.sort((a, b) => compareActions(a.action, b.action));
|
|
357
541
|
|
|
358
542
|
try {
|
|
543
|
+
// Bundle-level eth_simulateV1: filters out entries that revert and derives the gasLimit.
|
|
544
|
+
const bundleResult = await this.bundleSimulator.simulate(validRequests, currentL2Slot);
|
|
545
|
+
|
|
546
|
+
if (bundleResult.kind === 'aborted') {
|
|
547
|
+
this.logDroppedInSim(bundleResult.droppedRequests);
|
|
548
|
+
void this.backupDroppedInSim(bundleResult.droppedRequests, currentL2Slot).catch(err =>
|
|
549
|
+
this.log.error(`Failed to backup requests dropped in simulation`, err),
|
|
550
|
+
);
|
|
551
|
+
return undefined;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
const { requests, droppedRequests, gasLimit } =
|
|
555
|
+
bundleResult.kind === 'fallback'
|
|
556
|
+
? {
|
|
557
|
+
requests: bundleResult.requests,
|
|
558
|
+
droppedRequests: bundleResult.droppedRequests,
|
|
559
|
+
gasLimit: MAX_L1_TX_LIMIT,
|
|
560
|
+
}
|
|
561
|
+
: bundleResult;
|
|
562
|
+
|
|
563
|
+
this.logDroppedInSim(droppedRequests);
|
|
564
|
+
|
|
565
|
+
// Compute blobConfig from survivors (not original validRequests) so that if the propose
|
|
566
|
+
// entry was dropped by bundleSimulate we don't attach a blob-typed config to a non-blob tx.
|
|
567
|
+
const [blobConfig] = requests.filter(r => r.blobConfig).map(r => r.blobConfig);
|
|
568
|
+
const txConfig: RequestWithExpiry['gasConfig'] = { gasLimit, txTimeoutAt };
|
|
569
|
+
|
|
359
570
|
this.log.debug('Forwarding transactions', {
|
|
360
|
-
|
|
571
|
+
requests: requests.map(request => request.action),
|
|
361
572
|
txConfig,
|
|
362
573
|
});
|
|
363
|
-
const result = await
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
574
|
+
const result = await this.forwardWithPublisherRotation(requests, txConfig, blobConfig, currentL2Slot);
|
|
575
|
+
if (result === undefined) {
|
|
576
|
+
return undefined;
|
|
577
|
+
}
|
|
578
|
+
const { successfulActions = [], failedActions = [] } = this.callbackBundledTransactions(requests, result);
|
|
579
|
+
const allFailedActions = [...failedActions, ...droppedRequests.map(d => d.request.action)];
|
|
580
|
+
return {
|
|
581
|
+
result,
|
|
582
|
+
expiredActions,
|
|
583
|
+
sentActions: requests.map(x => x.action),
|
|
584
|
+
successfulActions,
|
|
585
|
+
failedActions: allFailedActions,
|
|
586
|
+
};
|
|
373
587
|
} catch (err) {
|
|
374
588
|
const viemError = formatViemError(err);
|
|
375
589
|
this.log.error(`Failed to publish bundled transactions`, viemError);
|
|
590
|
+
if (err instanceof TimeoutError) {
|
|
591
|
+
const timeoutState = err instanceof L1TxTimeoutError ? err.txState : undefined;
|
|
592
|
+
void (async () => {
|
|
593
|
+
// The RPC is likely degraded right after a timeout, so back up without the block number
|
|
594
|
+
// rather than leaking an unhandled rejection.
|
|
595
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber().catch(() => 0n);
|
|
596
|
+
this.backupFailedTx(
|
|
597
|
+
{
|
|
598
|
+
id: this.failureRecordId(
|
|
599
|
+
validRequests.map(r => r.action),
|
|
600
|
+
currentL2Slot,
|
|
601
|
+
),
|
|
602
|
+
failureType: 'timeout',
|
|
603
|
+
request: { to: MULTI_CALL_3_ADDRESS as Hex, data: '0x' as Hex },
|
|
604
|
+
l1BlockNumber,
|
|
605
|
+
error: { message: viemError.message, name: 'TimeoutError' },
|
|
606
|
+
context: {
|
|
607
|
+
actions: validRequests.map(r => r.action),
|
|
608
|
+
requests: validRequests
|
|
609
|
+
.filter(r => r.request.to !== null)
|
|
610
|
+
.map(r => ({ action: r.action, to: r.request.to! as Hex, data: r.request.data! })),
|
|
611
|
+
sender: this.getSenderAddress().toString(),
|
|
612
|
+
slot: Number(currentL2Slot),
|
|
613
|
+
},
|
|
614
|
+
timing: this.computeTimingInfo(currentL2Slot),
|
|
615
|
+
gasInfo: timeoutState
|
|
616
|
+
? {
|
|
617
|
+
sentGasPriceLadder: timeoutState.gasPriceHistory,
|
|
618
|
+
attempts: timeoutState.attempts,
|
|
619
|
+
gasLimit: timeoutState.gasLimit,
|
|
620
|
+
nonce: timeoutState.nonce,
|
|
621
|
+
}
|
|
622
|
+
: undefined,
|
|
623
|
+
},
|
|
624
|
+
{ captureFeeSummary: true, targetSlot: currentL2Slot },
|
|
625
|
+
);
|
|
626
|
+
})();
|
|
627
|
+
}
|
|
376
628
|
return undefined;
|
|
377
629
|
} finally {
|
|
378
630
|
try {
|
|
@@ -386,49 +638,329 @@ export class SequencerPublisher {
|
|
|
386
638
|
}
|
|
387
639
|
}
|
|
388
640
|
|
|
641
|
+
/** Logs entries dropped by bundle simulation as warnings on the publisher's logger. */
|
|
642
|
+
private logDroppedInSim(dropped: DroppedRequest[]): void {
|
|
643
|
+
for (const drop of dropped) {
|
|
644
|
+
const revertReasonDecoded = drop.revertReason ?? tryDecodeRevertReason(drop.returnData, this.revertDecoderAbi);
|
|
645
|
+
this.log.warn('Bundle entry dropped: action reverted in sim', {
|
|
646
|
+
action: drop.request.action,
|
|
647
|
+
revertReason: revertReasonDecoded ?? drop.returnData,
|
|
648
|
+
revertReasonDecoded,
|
|
649
|
+
returnData: drop.returnData,
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/** Backs up entries dropped by bundle simulation, one record per dropped action. */
|
|
655
|
+
private async backupDroppedInSim(dropped: DroppedRequest[], targetSlot?: SlotNumber): Promise<void> {
|
|
656
|
+
if (dropped.length === 0) {
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
// Invoked as `void backupDroppedInSim(...)` on the publish path, so it must not throw.
|
|
660
|
+
try {
|
|
661
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
662
|
+
// Every dropped entry failed in the same slot against the same L1 fee conditions, so capture
|
|
663
|
+
// the fee environment once and share it rather than re-reading the window per entry.
|
|
664
|
+
const sharedFeeSummary = await this.captureFeeEnvironment(targetSlot).catch(() => undefined);
|
|
665
|
+
const timing = this.computeTimingInfo(targetSlot);
|
|
666
|
+
for (const { request: req } of dropped) {
|
|
667
|
+
this.backupFailedTx(
|
|
668
|
+
{
|
|
669
|
+
id: keccak256(req.request.data!),
|
|
670
|
+
failureType: 'simulation',
|
|
671
|
+
request: { to: req.request.to! as Hex, data: req.request.data! },
|
|
672
|
+
l1BlockNumber,
|
|
673
|
+
error: { message: 'Bundle entry dropped: action reverted in sim' },
|
|
674
|
+
context: {
|
|
675
|
+
actions: [req.action],
|
|
676
|
+
sender: this.getSenderAddress().toString(),
|
|
677
|
+
slot: targetSlot !== undefined ? Number(targetSlot) : undefined,
|
|
678
|
+
},
|
|
679
|
+
timing,
|
|
680
|
+
},
|
|
681
|
+
{ sharedFeeSummary },
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
} catch (err) {
|
|
685
|
+
this.log.warn(`Failed to back up dropped-in-sim entries`, err);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Forwards transactions via Multicall3, rotating to the next available publisher if a send
|
|
691
|
+
* failure occurs (i.e. the tx never reached the chain).
|
|
692
|
+
* On-chain reverts and simulation errors are returned as-is without rotation.
|
|
693
|
+
*/
|
|
694
|
+
private async forwardWithPublisherRotation(
|
|
695
|
+
validRequests: RequestWithExpiry[],
|
|
696
|
+
txConfig: RequestWithExpiry['gasConfig'],
|
|
697
|
+
blobConfig: L1BlobInputs | undefined,
|
|
698
|
+
targetSlot?: SlotNumber,
|
|
699
|
+
) {
|
|
700
|
+
if (!txConfig?.gasLimit) {
|
|
701
|
+
throw new Error('gasLimit is required for bundled transactions');
|
|
702
|
+
}
|
|
703
|
+
const txConfigWithGasLimit = txConfig as L1TxConfig & { gasLimit: bigint };
|
|
704
|
+
|
|
705
|
+
const triedAddresses: EthAddress[] = [];
|
|
706
|
+
let currentPublisher = this.l1TxUtils;
|
|
707
|
+
|
|
708
|
+
while (true) {
|
|
709
|
+
if (txConfig.txTimeoutAt && new Date() > txConfig.txTimeoutAt) {
|
|
710
|
+
this.log.warn(`Tx timeout (${txConfig.txTimeoutAt.toISOString()}) elapsed; stopping publisher rotation`, {
|
|
711
|
+
triedAddresses: triedAddresses.map(a => a.toString()),
|
|
712
|
+
});
|
|
713
|
+
return undefined;
|
|
714
|
+
}
|
|
715
|
+
triedAddresses.push(currentPublisher.getSenderAddress());
|
|
716
|
+
|
|
717
|
+
try {
|
|
718
|
+
const result = await Multicall3.forward(
|
|
719
|
+
validRequests.map(r => r.request),
|
|
720
|
+
currentPublisher,
|
|
721
|
+
txConfigWithGasLimit,
|
|
722
|
+
blobConfig,
|
|
723
|
+
{ gasLimitRequired: true },
|
|
724
|
+
);
|
|
725
|
+
this.l1TxUtils = currentPublisher;
|
|
726
|
+
return result;
|
|
727
|
+
} catch (err) {
|
|
728
|
+
if (err instanceof TimeoutError) {
|
|
729
|
+
throw err;
|
|
730
|
+
}
|
|
731
|
+
if (err instanceof MulticallForwarderRevertedError) {
|
|
732
|
+
this.log.error('Forwarder transaction reverted on-chain; not rotating publisher', err, {
|
|
733
|
+
transactionHash: err.receipt.transactionHash,
|
|
734
|
+
});
|
|
735
|
+
this.backupRevertFailure(validRequests, err, currentPublisher, targetSlot);
|
|
736
|
+
return undefined;
|
|
737
|
+
}
|
|
738
|
+
const viemError = formatViemError(err);
|
|
739
|
+
if (!this.getNextPublisher) {
|
|
740
|
+
this.log.error('Failed to publish bundled transactions', viemError);
|
|
741
|
+
this.backupSendFailure(validRequests, viemError, currentPublisher, targetSlot);
|
|
742
|
+
return undefined;
|
|
743
|
+
}
|
|
744
|
+
this.log.warn(
|
|
745
|
+
`Publisher ${currentPublisher.getSenderAddress()} failed to send, rotating to next publisher`,
|
|
746
|
+
viemError,
|
|
747
|
+
);
|
|
748
|
+
const nextPublisher = await this.getNextPublisher([...triedAddresses]);
|
|
749
|
+
if (!nextPublisher) {
|
|
750
|
+
this.log.error(
|
|
751
|
+
`All available publishers exhausted (tried ${triedAddresses.length}), failed to publish bundled transactions`,
|
|
752
|
+
viemError,
|
|
753
|
+
{ triedAddresses: triedAddresses.map(a => a.toString()) },
|
|
754
|
+
);
|
|
755
|
+
this.backupSendFailure(validRequests, viemError, currentPublisher, targetSlot);
|
|
756
|
+
return undefined;
|
|
757
|
+
}
|
|
758
|
+
currentPublisher = nextPublisher;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/** Backs up an on-chain revert failure to the failed tx store. */
|
|
764
|
+
private backupRevertFailure(
|
|
765
|
+
requests: RequestWithExpiry[],
|
|
766
|
+
err: MulticallForwarderRevertedError,
|
|
767
|
+
publisher: L1TxUtils,
|
|
768
|
+
targetSlot?: SlotNumber,
|
|
769
|
+
): void {
|
|
770
|
+
this.backupFailedTx(
|
|
771
|
+
{
|
|
772
|
+
id: err.receipt.transactionHash,
|
|
773
|
+
failureType: 'revert',
|
|
774
|
+
request: { to: MULTI_CALL_3_ADDRESS as Hex, data: '0x' as Hex },
|
|
775
|
+
l1BlockNumber: err.receipt.blockNumber,
|
|
776
|
+
receipt: {
|
|
777
|
+
transactionHash: err.receipt.transactionHash,
|
|
778
|
+
blockNumber: err.receipt.blockNumber,
|
|
779
|
+
gasUsed: err.receipt.gasUsed,
|
|
780
|
+
status: 'reverted',
|
|
781
|
+
},
|
|
782
|
+
error: { message: err.message, name: err.name },
|
|
783
|
+
context: {
|
|
784
|
+
actions: requests.map(r => r.action),
|
|
785
|
+
requests: requests
|
|
786
|
+
.filter(r => r.request.to !== null)
|
|
787
|
+
.map(r => ({ action: r.action, to: r.request.to! as Hex, data: r.request.data! })),
|
|
788
|
+
sender: publisher.getSenderAddress().toString(),
|
|
789
|
+
slot: targetSlot !== undefined ? Number(targetSlot) : undefined,
|
|
790
|
+
},
|
|
791
|
+
gasInfo: err.txState
|
|
792
|
+
? {
|
|
793
|
+
sentGasPrice: err.txState.gasPrice,
|
|
794
|
+
gasLimit: err.txState.gasLimit,
|
|
795
|
+
nonce: err.txState.nonce,
|
|
796
|
+
}
|
|
797
|
+
: undefined,
|
|
798
|
+
timing: this.computeTimingInfo(targetSlot),
|
|
799
|
+
},
|
|
800
|
+
{ captureFeeSummary: true, targetSlot },
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/** Backs up a send failure (tx never reached chain) to the failed tx store. */
|
|
805
|
+
private backupSendFailure(
|
|
806
|
+
requests: RequestWithExpiry[],
|
|
807
|
+
error: FormattedViemError | Error,
|
|
808
|
+
publisher: L1TxUtils,
|
|
809
|
+
targetSlot?: SlotNumber,
|
|
810
|
+
): void {
|
|
811
|
+
// If we can't get the block number, still back up without it.
|
|
812
|
+
void this.l1TxUtils
|
|
813
|
+
.getBlockNumber()
|
|
814
|
+
.catch(() => 0n)
|
|
815
|
+
.then(l1BlockNumber => {
|
|
816
|
+
this.backupFailedTx(
|
|
817
|
+
{
|
|
818
|
+
id: this.failureRecordId(
|
|
819
|
+
requests.map(r => r.action),
|
|
820
|
+
targetSlot,
|
|
821
|
+
),
|
|
822
|
+
failureType: 'send-error',
|
|
823
|
+
request: { to: MULTI_CALL_3_ADDRESS as Hex, data: '0x' as Hex },
|
|
824
|
+
l1BlockNumber,
|
|
825
|
+
error: {
|
|
826
|
+
message: error.message,
|
|
827
|
+
name: 'name' in error ? error.name : undefined,
|
|
828
|
+
},
|
|
829
|
+
context: {
|
|
830
|
+
actions: requests.map(r => r.action),
|
|
831
|
+
requests: requests
|
|
832
|
+
.filter(r => r.request.to !== null)
|
|
833
|
+
.map(r => ({ action: r.action, to: r.request.to! as Hex, data: r.request.data! })),
|
|
834
|
+
sender: publisher.getSenderAddress().toString(),
|
|
835
|
+
slot: targetSlot !== undefined ? Number(targetSlot) : undefined,
|
|
836
|
+
},
|
|
837
|
+
timing: this.computeTimingInfo(targetSlot),
|
|
838
|
+
},
|
|
839
|
+
{ captureFeeSummary: true, targetSlot },
|
|
840
|
+
);
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/*
|
|
845
|
+
* Schedules sending all enqueued requests at (or after) the start of the given L2 slot.
|
|
846
|
+
*/
|
|
847
|
+
public async sendRequestsAt(targetSlot: SlotNumber): Promise<SendRequestsResult | undefined> {
|
|
848
|
+
await this.waitForTargetSlot(targetSlot);
|
|
849
|
+
if (this.interrupted) {
|
|
850
|
+
return undefined;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
return this.sendRequests(targetSlot);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Sleeps until one L1 slot before the L2 slot boundary, and then waits for that L1 block
|
|
858
|
+
* to be mined, so we don't risk being included in it. If that block never gets mined after
|
|
859
|
+
* a timeout, we assume it got skipped on L1, so we send the tx anyway.
|
|
860
|
+
*/
|
|
861
|
+
private async waitForTargetSlot(targetSlot: SlotNumber): Promise<void> {
|
|
862
|
+
const l1Constants = this.epochCache.getL1Constants();
|
|
863
|
+
const nowInSeconds = this.dateProvider.nowInSeconds();
|
|
864
|
+
const startOfTargetSlotTs = getTimestampForSlot(targetSlot, l1Constants);
|
|
865
|
+
const previousL1BlockTs = startOfTargetSlotTs - this.ethereumSlotDuration;
|
|
866
|
+
const waitDeadlineTs = previousL1BlockTs + BigInt(this.previousL1BlockWaitTimeoutMs / 1000);
|
|
867
|
+
const logCtx = { targetSlot, startOfTargetSlotTs, nowInSeconds, previousL1BlockTs, waitDeadlineTs };
|
|
868
|
+
|
|
869
|
+
// Check if we are already past time
|
|
870
|
+
if (nowInSeconds >= startOfTargetSlotTs) {
|
|
871
|
+
this.log.verbose(`Target slot ${targetSlot} already started, sending requests immediately`, logCtx);
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
// Otherwise we wait
|
|
876
|
+
this.log.debug(`Waiting for slot ${targetSlot} before sending requests`, logCtx);
|
|
877
|
+
|
|
878
|
+
// Wait until previous L1 block timestamp first
|
|
879
|
+
const sleepMs = (Number(previousL1BlockTs) - nowInSeconds) * 1000;
|
|
880
|
+
if (sleepMs > 0 && !this.interrupted) {
|
|
881
|
+
this.log.trace(`Sleeping ${sleepMs}ms before waiting for previous L1 block`, logCtx);
|
|
882
|
+
await this.interruptibleSleep.sleep(sleepMs);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// Then loop until we see the previous L1 block, so we know that we cannot be included in it.
|
|
886
|
+
// We time out after a while, once we are sure that that block is skipped in L1.
|
|
887
|
+
while (!this.interrupted) {
|
|
888
|
+
try {
|
|
889
|
+
const nowInSeconds = this.dateProvider.nowInSeconds();
|
|
890
|
+
logCtx.nowInSeconds = nowInSeconds;
|
|
891
|
+
|
|
892
|
+
if (nowInSeconds >= waitDeadlineTs) {
|
|
893
|
+
this.log.warn(`Timed out waiting for previous L1 block before sending requests, proceeding`, logCtx);
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
const latestBlockTs = await this.l1TxUtils.getBlock().then(b => b.timestamp);
|
|
898
|
+
if (latestBlockTs >= previousL1BlockTs) {
|
|
899
|
+
this.log.debug(`Previous L1 block mined, proceeding to send requests`, { ...logCtx, latestBlockTs });
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
this.log.trace(`Previous L1 block not mined yet, continuing to wait`, { ...logCtx, latestBlockTs });
|
|
903
|
+
} catch (err) {
|
|
904
|
+
this.log.error(`Error while waiting for previous L1 block before sending requests; retrying`, err, logCtx);
|
|
905
|
+
} finally {
|
|
906
|
+
await this.interruptibleSleep.sleep(this.previousL1BlockWaitPollIntervalMs);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
|
|
389
911
|
private callbackBundledTransactions(
|
|
390
912
|
requests: RequestWithExpiry[],
|
|
391
|
-
result
|
|
913
|
+
result: { receipt: TransactionReceipt; multicallData: Hex },
|
|
392
914
|
) {
|
|
393
915
|
const actionsListStr = requests.map(r => r.action).join(', ');
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
916
|
+
this.log.verbose(`Published bundled transactions (${actionsListStr})`, {
|
|
917
|
+
result,
|
|
918
|
+
requests: requests.map(r => ({
|
|
919
|
+
...r,
|
|
920
|
+
// Avoid logging large blob data
|
|
921
|
+
blobConfig: r.blobConfig
|
|
922
|
+
? { ...r.blobConfig, blobs: r.blobConfig.blobs.map(b => ({ size: trimmedBytesLength(b) })) }
|
|
923
|
+
: undefined,
|
|
924
|
+
})),
|
|
925
|
+
});
|
|
926
|
+
const successfulActions: Action[] = [];
|
|
927
|
+
const failedActions: Action[] = [];
|
|
928
|
+
for (const request of requests) {
|
|
929
|
+
if (request.checkSuccess(request.request, result)) {
|
|
930
|
+
successfulActions.push(request.action);
|
|
931
|
+
} else {
|
|
932
|
+
failedActions.push(request.action);
|
|
407
933
|
}
|
|
408
|
-
return { successfulActions, failedActions };
|
|
409
934
|
}
|
|
935
|
+
return { successfulActions, failedActions };
|
|
410
936
|
}
|
|
411
937
|
|
|
412
938
|
/**
|
|
413
|
-
* @notice Will call `
|
|
939
|
+
* @notice Will call `canProposeAt` to make sure that it is possible to propose
|
|
414
940
|
* @param tipArchive - The archive to check
|
|
415
941
|
* @returns The slot and block number if it is possible to propose, undefined otherwise
|
|
416
942
|
*/
|
|
417
|
-
public
|
|
418
|
-
tipArchive: Fr,
|
|
419
|
-
msgSender: EthAddress,
|
|
420
|
-
opts: { forcePendingCheckpointNumber?: CheckpointNumber } = {},
|
|
421
|
-
) {
|
|
943
|
+
public async canProposeAt(tipArchive: Fr, msgSender: EthAddress, simulationOverridesPlan?: SimulationOverridesPlan) {
|
|
422
944
|
// TODO: #14291 - should loop through multiple keys to check if any of them can propose
|
|
423
|
-
|
|
945
|
+
// These errors are expected when we cannot actually propose right now — usually because our
|
|
946
|
+
// local view of the chain is ahead of L1 (proposed parent hasn't landed yet, or someone
|
|
947
|
+
// else has just landed the slot, or the archive override doesn't match). We log a warn and
|
|
948
|
+
// skip the proposal; we do NOT treat these as bugs.
|
|
949
|
+
const expectedErrors = ['SlotAlreadyInChain', 'InvalidProposer', 'InvalidArchive'];
|
|
950
|
+
|
|
951
|
+
const slotOffset = this.aztecSlotDuration;
|
|
952
|
+
const nextL1SlotTs = this.getNextL1SlotTimestamp() + slotOffset;
|
|
424
953
|
|
|
425
954
|
return this.rollupContract
|
|
426
|
-
.
|
|
427
|
-
|
|
428
|
-
|
|
955
|
+
.canProposeAt(
|
|
956
|
+
tipArchive.toBuffer(),
|
|
957
|
+
msgSender.toString(),
|
|
958
|
+
nextL1SlotTs,
|
|
959
|
+
await buildSimulationOverridesStateOverride(this.rollupContract, simulationOverridesPlan),
|
|
960
|
+
)
|
|
429
961
|
.catch(err => {
|
|
430
|
-
if (err instanceof FormattedViemError &&
|
|
431
|
-
this.log.warn(`Failed canProposeAtTime check with ${
|
|
962
|
+
if (err instanceof FormattedViemError && expectedErrors.find(e => err.message.includes(e))) {
|
|
963
|
+
this.log.warn(`Failed canProposeAtTime check with ${expectedErrors.find(e => err.message.includes(e))}`, {
|
|
432
964
|
error: err.message,
|
|
433
965
|
});
|
|
434
966
|
} else {
|
|
@@ -437,6 +969,7 @@ export class SequencerPublisher {
|
|
|
437
969
|
return undefined;
|
|
438
970
|
});
|
|
439
971
|
}
|
|
972
|
+
|
|
440
973
|
/**
|
|
441
974
|
* @notice Will simulate `validateHeader` to make sure that the block header is valid
|
|
442
975
|
* @dev This is a convenience function that can be used by the sequencer to validate a "partial" header.
|
|
@@ -446,13 +979,13 @@ export class SequencerPublisher {
|
|
|
446
979
|
@trackSpan('SequencerPublisher.validateBlockHeader')
|
|
447
980
|
public async validateBlockHeader(
|
|
448
981
|
header: CheckpointHeader,
|
|
449
|
-
|
|
982
|
+
simulationOverridesPlan?: SimulationOverridesPlan,
|
|
450
983
|
): Promise<void> {
|
|
451
984
|
const flags = { ignoreDA: true, ignoreSignatures: true };
|
|
452
985
|
|
|
453
986
|
const args = [
|
|
454
987
|
header.toViem(),
|
|
455
|
-
CommitteeAttestationsAndSigners.
|
|
988
|
+
CommitteeAttestationsAndSigners.packAttestations([]),
|
|
456
989
|
[], // no signers
|
|
457
990
|
Signature.empty().toViemSignature(),
|
|
458
991
|
`0x${'0'.repeat(64)}`, // 32 empty bytes
|
|
@@ -460,10 +993,9 @@ export class SequencerPublisher {
|
|
|
460
993
|
flags,
|
|
461
994
|
] as const;
|
|
462
995
|
|
|
463
|
-
const
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
);
|
|
996
|
+
const l1Constants = this.epochCache.getL1Constants();
|
|
997
|
+
const ts = getLastL1SlotTimestampForL2Slot(header.slotNumber, l1Constants);
|
|
998
|
+
const stateOverrides = await buildSimulationOverridesStateOverride(this.rollupContract, simulationOverridesPlan);
|
|
467
999
|
let balance = 0n;
|
|
468
1000
|
if (this.config.fishermanMode) {
|
|
469
1001
|
// In fisherman mode, we can't know where the proposer is publishing from
|
|
@@ -483,7 +1015,7 @@ export class SequencerPublisher {
|
|
|
483
1015
|
data: encodeFunctionData({ abi: RollupAbi, functionName: 'validateHeaderWithAttestations', args }),
|
|
484
1016
|
from: MULTI_CALL_3_ADDRESS,
|
|
485
1017
|
},
|
|
486
|
-
{ time: ts
|
|
1018
|
+
{ time: ts },
|
|
487
1019
|
stateOverrides,
|
|
488
1020
|
);
|
|
489
1021
|
this.log.debug(`Simulated validateHeader`);
|
|
@@ -516,8 +1048,15 @@ export class SequencerPublisher {
|
|
|
516
1048
|
const request = this.buildInvalidateCheckpointRequest(validationResult);
|
|
517
1049
|
this.log.debug(`Simulating invalidate checkpoint ${checkpointNumber}`, { ...logData, request });
|
|
518
1050
|
|
|
1051
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
1052
|
+
|
|
519
1053
|
try {
|
|
520
|
-
const { gasUsed } = await this.l1TxUtils.simulate(
|
|
1054
|
+
const { gasUsed } = await this.l1TxUtils.simulate(
|
|
1055
|
+
request,
|
|
1056
|
+
undefined,
|
|
1057
|
+
undefined,
|
|
1058
|
+
mergeAbis([request.abi ?? [], ErrorsAbi]),
|
|
1059
|
+
);
|
|
521
1060
|
this.log.verbose(`Simulation for invalidate checkpoint ${checkpointNumber} succeeded`, {
|
|
522
1061
|
...logData,
|
|
523
1062
|
request,
|
|
@@ -529,6 +1068,7 @@ export class SequencerPublisher {
|
|
|
529
1068
|
gasUsed,
|
|
530
1069
|
checkpointNumber,
|
|
531
1070
|
forcePendingCheckpointNumber: CheckpointNumber(checkpointNumber - 1),
|
|
1071
|
+
lastArchive: validationResult.checkpoint.lastArchive,
|
|
532
1072
|
reason,
|
|
533
1073
|
};
|
|
534
1074
|
} catch (err) {
|
|
@@ -536,13 +1076,13 @@ export class SequencerPublisher {
|
|
|
536
1076
|
|
|
537
1077
|
// If the error is due to the checkpoint not being in the pending chain, and it was indeed removed by someone else,
|
|
538
1078
|
// we can safely ignore it and return undefined so we go ahead with checkpoint building.
|
|
539
|
-
if (viemError.message?.includes('
|
|
1079
|
+
if (viemError.message?.includes('Rollup__CheckpointNotInPendingChain')) {
|
|
540
1080
|
this.log.verbose(
|
|
541
1081
|
`Simulation for invalidate checkpoint ${checkpointNumber} failed due to checkpoint not being in pending chain`,
|
|
542
1082
|
{ ...logData, request, error: viemError.message },
|
|
543
1083
|
);
|
|
544
|
-
const
|
|
545
|
-
if (
|
|
1084
|
+
const latestProposedCheckpointNumber = await this.rollupContract.getCheckpointNumber();
|
|
1085
|
+
if (latestProposedCheckpointNumber < checkpointNumber) {
|
|
546
1086
|
this.log.verbose(`Checkpoint ${checkpointNumber} has already been invalidated`, { ...logData });
|
|
547
1087
|
return undefined;
|
|
548
1088
|
} else {
|
|
@@ -562,6 +1102,22 @@ export class SequencerPublisher {
|
|
|
562
1102
|
|
|
563
1103
|
// Otherwise, throw. We cannot build the next checkpoint if we cannot invalidate the previous one.
|
|
564
1104
|
this.log.error(`Simulation for invalidate checkpoint ${checkpointNumber} failed`, viemError, logData);
|
|
1105
|
+
this.backupFailedTx(
|
|
1106
|
+
{
|
|
1107
|
+
id: keccak256(request.data!),
|
|
1108
|
+
failureType: 'simulation',
|
|
1109
|
+
request: { to: request.to!, data: request.data!, value: request.value },
|
|
1110
|
+
l1BlockNumber,
|
|
1111
|
+
error: { message: viemError.message, name: viemError.name },
|
|
1112
|
+
context: {
|
|
1113
|
+
actions: [`invalidate-${reason}`],
|
|
1114
|
+
checkpointNumber,
|
|
1115
|
+
sender: this.getSenderAddress().toString(),
|
|
1116
|
+
},
|
|
1117
|
+
timing: this.computeTimingInfo(this.getCurrentL2Slot()),
|
|
1118
|
+
},
|
|
1119
|
+
{ captureFeeSummary: true, targetSlot: this.getCurrentL2Slot() },
|
|
1120
|
+
);
|
|
565
1121
|
throw new Error(`Failed to simulate invalidate checkpoint ${checkpointNumber}`, { cause: viemError });
|
|
566
1122
|
}
|
|
567
1123
|
}
|
|
@@ -575,9 +1131,11 @@ export class SequencerPublisher {
|
|
|
575
1131
|
const logData = { ...checkpoint, reason };
|
|
576
1132
|
this.log.debug(`Building invalidate checkpoint ${checkpoint.checkpointNumber} request`, logData);
|
|
577
1133
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
)
|
|
1134
|
+
// Use the exact packed tuple posted to L1 verbatim. A repack via `packAttestations` is not a
|
|
1135
|
+
// byte-faithful inverse of `fromPacked` (a canonicalized yParity byte or an all-zero signature slot
|
|
1136
|
+
// round-trips differently), so it would diverge from the stored `attestationsHash` and revert the
|
|
1137
|
+
// invalidation.
|
|
1138
|
+
const attestationsAndSigners = validationResult.verbatimAttestations;
|
|
581
1139
|
|
|
582
1140
|
if (reason === 'invalid-attestation') {
|
|
583
1141
|
return this.rollupContract.buildInvalidateBadAttestationRequest(
|
|
@@ -598,59 +1156,11 @@ export class SequencerPublisher {
|
|
|
598
1156
|
}
|
|
599
1157
|
}
|
|
600
1158
|
|
|
601
|
-
/** Simulates `propose` to make sure that the checkpoint is valid for submission */
|
|
602
|
-
@trackSpan('SequencerPublisher.validateCheckpointForSubmission')
|
|
603
|
-
public async validateCheckpointForSubmission(
|
|
604
|
-
checkpoint: Checkpoint,
|
|
605
|
-
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
606
|
-
attestationsAndSignersSignature: Signature,
|
|
607
|
-
options: { forcePendingCheckpointNumber?: CheckpointNumber },
|
|
608
|
-
): Promise<bigint> {
|
|
609
|
-
const ts = BigInt((await this.l1TxUtils.getBlock()).timestamp + this.ethereumSlotDuration);
|
|
610
|
-
|
|
611
|
-
// TODO(palla/mbps): This should not be needed, there's no flow where we propose with zero attestations. Or is there?
|
|
612
|
-
// If we have no attestations, we still need to provide the empty attestations
|
|
613
|
-
// so that the committee is recalculated correctly
|
|
614
|
-
// const ignoreSignatures = attestationsAndSigners.attestations.length === 0;
|
|
615
|
-
// if (ignoreSignatures) {
|
|
616
|
-
// const { committee } = await this.epochCache.getCommittee(block.header.globalVariables.slotNumber);
|
|
617
|
-
// if (!committee) {
|
|
618
|
-
// this.log.warn(`No committee found for slot ${block.header.globalVariables.slotNumber}`);
|
|
619
|
-
// throw new Error(`No committee found for slot ${block.header.globalVariables.slotNumber}`);
|
|
620
|
-
// }
|
|
621
|
-
// attestationsAndSigners.attestations = committee.map(committeeMember =>
|
|
622
|
-
// CommitteeAttestation.fromAddress(committeeMember),
|
|
623
|
-
// );
|
|
624
|
-
// }
|
|
625
|
-
|
|
626
|
-
const blobFields = checkpoint.toBlobFields();
|
|
627
|
-
const blobs = getBlobsPerL1Block(blobFields);
|
|
628
|
-
const blobInput = getPrefixedEthBlobCommitments(blobs);
|
|
629
|
-
|
|
630
|
-
const args = [
|
|
631
|
-
{
|
|
632
|
-
header: checkpoint.header.toViem(),
|
|
633
|
-
archive: toHex(checkpoint.archive.root.toBuffer()),
|
|
634
|
-
oracleInput: {
|
|
635
|
-
feeAssetPriceModifier: 0n,
|
|
636
|
-
},
|
|
637
|
-
},
|
|
638
|
-
attestationsAndSigners.getPackedAttestations(),
|
|
639
|
-
attestationsAndSigners.getSigners().map(signer => signer.toString()),
|
|
640
|
-
attestationsAndSignersSignature.toViemSignature(),
|
|
641
|
-
blobInput,
|
|
642
|
-
] as const;
|
|
643
|
-
|
|
644
|
-
await this.simulateProposeTx(args, ts, options);
|
|
645
|
-
return ts;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
1159
|
private async enqueueCastSignalHelper(
|
|
649
1160
|
slotNumber: SlotNumber,
|
|
650
|
-
timestamp: bigint,
|
|
651
1161
|
signalType: GovernanceSignalAction,
|
|
652
1162
|
payload: EthAddress,
|
|
653
|
-
base:
|
|
1163
|
+
base: GovernanceProposerContract,
|
|
654
1164
|
signerAddress: EthAddress,
|
|
655
1165
|
signer: (msg: TypedDataDefinition) => Promise<`0x${string}`>,
|
|
656
1166
|
): Promise<boolean> {
|
|
@@ -665,6 +1175,19 @@ export class SequencerPublisher {
|
|
|
665
1175
|
this.log.warn(`Cannot enqueue vote cast signal ${signalType} for address zero at slot ${slotNumber}`);
|
|
666
1176
|
return false;
|
|
667
1177
|
}
|
|
1178
|
+
|
|
1179
|
+
const canonicalRollup = await base.getRollupAddress();
|
|
1180
|
+
if (!canonicalRollup.equals(EthAddress.fromString(this.rollupContract.address))) {
|
|
1181
|
+
this.log.warn(`Rollup ${this.rollupContract.address} is not canonical, skipping governance signal`, {
|
|
1182
|
+
slotNumber,
|
|
1183
|
+
signalType,
|
|
1184
|
+
canonicalRollup,
|
|
1185
|
+
targetRollup: this.rollupContract.address,
|
|
1186
|
+
payload: payload.toString(),
|
|
1187
|
+
});
|
|
1188
|
+
return false;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
668
1191
|
const round = await base.computeRound(slotNumber);
|
|
669
1192
|
const roundInfo = await base.getRoundInfo(this.rollupContract.address, round);
|
|
670
1193
|
|
|
@@ -676,11 +1199,46 @@ export class SequencerPublisher {
|
|
|
676
1199
|
return false;
|
|
677
1200
|
}
|
|
678
1201
|
|
|
679
|
-
if (await
|
|
1202
|
+
if (await base.isPayloadEmpty(payload)) {
|
|
680
1203
|
this.log.warn(`Skipping vote cast for payload with empty code`);
|
|
681
1204
|
return false;
|
|
682
1205
|
}
|
|
683
1206
|
|
|
1207
|
+
// Classify the payload against the Governance proposal history so we stop signalling once its
|
|
1208
|
+
// proposal is live or was already executed, while still re-signalling one whose proposal was
|
|
1209
|
+
// merely rejected/dropped/expired.
|
|
1210
|
+
let status: PayloadProposalStatus = 'none';
|
|
1211
|
+
try {
|
|
1212
|
+
status = await base.getPayloadProposalStatus(payload.toString());
|
|
1213
|
+
} catch (err) {
|
|
1214
|
+
// We deliberately swallow the error and proceed to signal. Failing closed (skipping the
|
|
1215
|
+
// signal) on transient RPC errors would let a flaky L1 endpoint silence governance
|
|
1216
|
+
// participation entirely; failing open at worst produces a duplicate signal that the
|
|
1217
|
+
// contract will simply count alongside others in the round.
|
|
1218
|
+
this.log.error(`Failed to check governance proposal status for payload ${payload} (signalling anyway)`, err, {
|
|
1219
|
+
slotNumber,
|
|
1220
|
+
signalType,
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
if (status === 'live') {
|
|
1225
|
+
this.log.info(`Payload ${payload} has a live governance proposal, stopping signals`, {
|
|
1226
|
+
slotNumber,
|
|
1227
|
+
signalType,
|
|
1228
|
+
payload: payload.toString(),
|
|
1229
|
+
});
|
|
1230
|
+
return false;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
if (status === 'executed' && !this.config.governanceProposerForcePayloadVote) {
|
|
1234
|
+
this.log.info(
|
|
1235
|
+
`Payload ${payload} was executed by governance within lookback, stopping signals ` +
|
|
1236
|
+
`(set GOVERNANCE_PROPOSER_FORCE_PAYLOAD_VOTE to re-signal)`,
|
|
1237
|
+
{ slotNumber, signalType, payload: payload.toString() },
|
|
1238
|
+
);
|
|
1239
|
+
return false;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
684
1242
|
const cachedLastVote = this.lastActions[signalType];
|
|
685
1243
|
this.lastActions[signalType] = slotNumber;
|
|
686
1244
|
const action = signalType;
|
|
@@ -699,26 +1257,19 @@ export class SequencerPublisher {
|
|
|
699
1257
|
lastValidL2Slot: slotNumber,
|
|
700
1258
|
});
|
|
701
1259
|
|
|
702
|
-
try {
|
|
703
|
-
await this.l1TxUtils.simulate(request, { time: timestamp }, [], ErrorsAbi);
|
|
704
|
-
this.log.debug(`Simulation for ${action} at slot ${slotNumber} succeeded`, { request });
|
|
705
|
-
} catch (err) {
|
|
706
|
-
this.log.error(`Failed simulation for ${action} at slot ${slotNumber} (enqueuing the action anyway)`, err);
|
|
707
|
-
// Yes, we enqueue the request anyway, in case there was a bug with the simulation itself
|
|
708
|
-
}
|
|
709
|
-
|
|
710
1260
|
// TODO(palla/slash): All votes (governance and slashing) should txTimeoutAt at the end of the slot.
|
|
711
1261
|
this.addRequest({
|
|
712
|
-
gasConfig: { gasLimit: SequencerPublisher.VOTE_GAS_GUESS },
|
|
713
1262
|
action,
|
|
714
1263
|
request,
|
|
715
1264
|
lastValidL2Slot: slotNumber,
|
|
716
1265
|
checkSuccess: (_request, result) => {
|
|
717
1266
|
const success =
|
|
718
1267
|
result &&
|
|
719
|
-
result.receipt
|
|
720
|
-
|
|
721
|
-
|
|
1268
|
+
extractEventSuccess(result.receipt, {
|
|
1269
|
+
address: base.address.toString(),
|
|
1270
|
+
abi: EmpireBaseAbi,
|
|
1271
|
+
eventName: 'SignalCast',
|
|
1272
|
+
});
|
|
722
1273
|
|
|
723
1274
|
const logData = { ...result, slotNumber, round, payload: payload.toString() };
|
|
724
1275
|
if (!success) {
|
|
@@ -740,33 +1291,19 @@ export class SequencerPublisher {
|
|
|
740
1291
|
return true;
|
|
741
1292
|
}
|
|
742
1293
|
|
|
743
|
-
private async isPayloadEmpty(payload: EthAddress): Promise<boolean> {
|
|
744
|
-
const key = payload.toString();
|
|
745
|
-
const cached = this.isPayloadEmptyCache.get(key);
|
|
746
|
-
if (cached) {
|
|
747
|
-
return cached;
|
|
748
|
-
}
|
|
749
|
-
const isEmpty = !(await this.l1TxUtils.getCode(payload));
|
|
750
|
-
this.isPayloadEmptyCache.set(key, isEmpty);
|
|
751
|
-
return isEmpty;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
1294
|
/**
|
|
755
1295
|
* Enqueues a governance castSignal transaction to cast a signal for a given slot number.
|
|
756
1296
|
* @param slotNumber - The slot number to cast a signal for.
|
|
757
|
-
* @param timestamp - The timestamp of the slot to cast a signal for.
|
|
758
1297
|
* @returns True if the signal was successfully enqueued, false otherwise.
|
|
759
1298
|
*/
|
|
760
1299
|
public enqueueGovernanceCastSignal(
|
|
761
1300
|
governancePayload: EthAddress,
|
|
762
1301
|
slotNumber: SlotNumber,
|
|
763
|
-
timestamp: bigint,
|
|
764
1302
|
signerAddress: EthAddress,
|
|
765
1303
|
signer: (msg: TypedDataDefinition) => Promise<`0x${string}`>,
|
|
766
1304
|
): Promise<boolean> {
|
|
767
1305
|
return this.enqueueCastSignalHelper(
|
|
768
1306
|
slotNumber,
|
|
769
|
-
timestamp,
|
|
770
1307
|
'governance-signal',
|
|
771
1308
|
governancePayload,
|
|
772
1309
|
this.govProposerContract,
|
|
@@ -775,11 +1312,51 @@ export class SequencerPublisher {
|
|
|
775
1312
|
);
|
|
776
1313
|
}
|
|
777
1314
|
|
|
1315
|
+
/**
|
|
1316
|
+
* Enqueues a `prune()` transaction if the rollup is prunable at the given slot's L1 timestamp.
|
|
1317
|
+
* `prune()` is permissionless and idempotent — if the chain is no longer prunable by send time the
|
|
1318
|
+
* bundle simulation usually drops the entry; on a node without `eth_simulateV1` the bundle is sent
|
|
1319
|
+
* as-is and the prune reverts `Rollup__NothingToPrune` inside `aggregate3(allowFailure: true)`
|
|
1320
|
+
* (a failed action, never a whole-tx revert). Used by the failed-sync fallback so a stuck pending
|
|
1321
|
+
* chain (e.g. bad data blocking sync) can be wound back to recover.
|
|
1322
|
+
* @returns true if a prune request was enqueued, false otherwise.
|
|
1323
|
+
*/
|
|
1324
|
+
public async enqueuePruneIfPrunable(slotNumber: SlotNumber): Promise<boolean> {
|
|
1325
|
+
if (this.lastActions['prune'] === slotNumber) {
|
|
1326
|
+
this.log.debug(`Skipping duplicate prune for slot ${slotNumber}`, { slotNumber });
|
|
1327
|
+
return false;
|
|
1328
|
+
}
|
|
1329
|
+
// Use the SAME timestamp the bundle simulator overrides block.timestamp with at send time
|
|
1330
|
+
// (sequencer-bundle-simulator.ts) so this upfront check and the send-time sim agree. Slot-start
|
|
1331
|
+
// and last-L1-slot both fall within the same L2 slot (and epoch, which is what `canPruneAtTime`
|
|
1332
|
+
// derives), so they agree today; matching the simulator keeps it robust if the contract ever uses
|
|
1333
|
+
// the timestamp more granularly.
|
|
1334
|
+
const ts = getLastL1SlotTimestampForL2Slot(slotNumber, this.epochCache.getL1Constants());
|
|
1335
|
+
const canPrune = await this.rollupContract.canPruneAtTime(ts).catch(err => {
|
|
1336
|
+
this.log.error(`Failed to check canPruneAtTime for slot ${slotNumber}`, err, { slotNumber });
|
|
1337
|
+
return false;
|
|
1338
|
+
});
|
|
1339
|
+
if (!canPrune) {
|
|
1340
|
+
this.log.debug(`Rollup not prunable at slot ${slotNumber}`, { slotNumber });
|
|
1341
|
+
return false;
|
|
1342
|
+
}
|
|
1343
|
+
const request: L1TxRequest = {
|
|
1344
|
+
to: this.rollupContract.address,
|
|
1345
|
+
data: encodeFunctionData({ abi: RollupAbi, functionName: 'prune', args: [] }),
|
|
1346
|
+
};
|
|
1347
|
+
this.log.info(`Enqueuing rollup prune for slot ${slotNumber}`, { slotNumber });
|
|
1348
|
+
return this.enqueueRequest(
|
|
1349
|
+
'prune',
|
|
1350
|
+
request,
|
|
1351
|
+
{ address: this.rollupContract.address, abi: RollupAbi, eventName: 'PrunedPending' },
|
|
1352
|
+
slotNumber,
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
778
1356
|
/** Enqueues all slashing actions as returned by the slasher client. */
|
|
779
1357
|
public async enqueueSlashingActions(
|
|
780
1358
|
actions: ProposerSlashAction[],
|
|
781
1359
|
slotNumber: SlotNumber,
|
|
782
|
-
timestamp: bigint,
|
|
783
1360
|
signerAddress: EthAddress,
|
|
784
1361
|
signer: (msg: TypedDataDefinition) => Promise<`0x${string}`>,
|
|
785
1362
|
): Promise<boolean> {
|
|
@@ -790,58 +1367,6 @@ export class SequencerPublisher {
|
|
|
790
1367
|
|
|
791
1368
|
for (const action of actions) {
|
|
792
1369
|
switch (action.type) {
|
|
793
|
-
case 'vote-empire-payload': {
|
|
794
|
-
if (this.slashingProposerContract?.type !== 'empire') {
|
|
795
|
-
this.log.error('Cannot vote for empire payload on non-empire slashing contract');
|
|
796
|
-
break;
|
|
797
|
-
}
|
|
798
|
-
this.log.debug(`Enqueuing slashing vote for payload ${action.payload} at slot ${slotNumber}`, {
|
|
799
|
-
signerAddress,
|
|
800
|
-
});
|
|
801
|
-
await this.enqueueCastSignalHelper(
|
|
802
|
-
slotNumber,
|
|
803
|
-
timestamp,
|
|
804
|
-
'empire-slashing-signal',
|
|
805
|
-
action.payload,
|
|
806
|
-
this.slashingProposerContract,
|
|
807
|
-
signerAddress,
|
|
808
|
-
signer,
|
|
809
|
-
);
|
|
810
|
-
break;
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
case 'create-empire-payload': {
|
|
814
|
-
this.log.debug(`Enqueuing slashing create payload at slot ${slotNumber}`, { slotNumber, signerAddress });
|
|
815
|
-
const request = this.slashFactoryContract.buildCreatePayloadRequest(action.data);
|
|
816
|
-
await this.simulateAndEnqueueRequest(
|
|
817
|
-
'create-empire-payload',
|
|
818
|
-
request,
|
|
819
|
-
(receipt: TransactionReceipt) =>
|
|
820
|
-
!!this.slashFactoryContract.tryExtractSlashPayloadCreatedEvent(receipt.logs),
|
|
821
|
-
slotNumber,
|
|
822
|
-
timestamp,
|
|
823
|
-
);
|
|
824
|
-
break;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
case 'execute-empire-payload': {
|
|
828
|
-
this.log.debug(`Enqueuing slashing execute payload at slot ${slotNumber}`, { slotNumber, signerAddress });
|
|
829
|
-
if (this.slashingProposerContract?.type !== 'empire') {
|
|
830
|
-
this.log.error('Cannot execute slashing payload on non-empire slashing contract');
|
|
831
|
-
return false;
|
|
832
|
-
}
|
|
833
|
-
const empireSlashingProposer = this.slashingProposerContract as EmpireSlashingProposerContract;
|
|
834
|
-
const request = empireSlashingProposer.buildExecuteRoundRequest(action.round);
|
|
835
|
-
await this.simulateAndEnqueueRequest(
|
|
836
|
-
'execute-empire-payload',
|
|
837
|
-
request,
|
|
838
|
-
(receipt: TransactionReceipt) => !!empireSlashingProposer.tryExtractPayloadSubmittedEvent(receipt.logs),
|
|
839
|
-
slotNumber,
|
|
840
|
-
timestamp,
|
|
841
|
-
);
|
|
842
|
-
break;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
1370
|
case 'vote-offenses': {
|
|
846
1371
|
this.log.debug(`Enqueuing slashing vote for ${action.votes.length} votes at slot ${slotNumber}`, {
|
|
847
1372
|
slotNumber,
|
|
@@ -849,19 +1374,21 @@ export class SequencerPublisher {
|
|
|
849
1374
|
votesCount: action.votes.length,
|
|
850
1375
|
signerAddress,
|
|
851
1376
|
});
|
|
852
|
-
if (this.slashingProposerContract
|
|
853
|
-
this.log.error('
|
|
1377
|
+
if (!this.slashingProposerContract) {
|
|
1378
|
+
this.log.error('No slashing proposer contract available');
|
|
854
1379
|
return false;
|
|
855
1380
|
}
|
|
856
|
-
const tallySlashingProposer = this.slashingProposerContract as TallySlashingProposerContract;
|
|
857
1381
|
const votes = bufferToHex(encodeSlashConsensusVotes(action.votes));
|
|
858
|
-
const request = await
|
|
859
|
-
|
|
1382
|
+
const request = await this.slashingProposerContract.buildVoteRequestFromSigner(votes, slotNumber, signer);
|
|
1383
|
+
this.enqueueRequest(
|
|
860
1384
|
'vote-offenses',
|
|
861
1385
|
request,
|
|
862
|
-
|
|
1386
|
+
{
|
|
1387
|
+
address: this.slashingProposerContract.address.toString(),
|
|
1388
|
+
abi: SlashingProposerAbi,
|
|
1389
|
+
eventName: 'VoteCast',
|
|
1390
|
+
},
|
|
863
1391
|
slotNumber,
|
|
864
|
-
timestamp,
|
|
865
1392
|
);
|
|
866
1393
|
break;
|
|
867
1394
|
}
|
|
@@ -872,18 +1399,23 @@ export class SequencerPublisher {
|
|
|
872
1399
|
round: action.round,
|
|
873
1400
|
signerAddress,
|
|
874
1401
|
});
|
|
875
|
-
if (this.slashingProposerContract
|
|
876
|
-
this.log.error('
|
|
1402
|
+
if (!this.slashingProposerContract) {
|
|
1403
|
+
this.log.error('No slashing proposer contract available');
|
|
877
1404
|
return false;
|
|
878
1405
|
}
|
|
879
|
-
const
|
|
880
|
-
|
|
881
|
-
|
|
1406
|
+
const executeRequest = this.slashingProposerContract.buildExecuteRoundRequest(
|
|
1407
|
+
action.round,
|
|
1408
|
+
action.committees,
|
|
1409
|
+
);
|
|
1410
|
+
this.enqueueRequest(
|
|
882
1411
|
'execute-slash',
|
|
883
|
-
|
|
884
|
-
|
|
1412
|
+
executeRequest,
|
|
1413
|
+
{
|
|
1414
|
+
address: this.slashingProposerContract.address.toString(),
|
|
1415
|
+
abi: SlashingProposerAbi,
|
|
1416
|
+
eventName: 'RoundExecuted',
|
|
1417
|
+
},
|
|
885
1418
|
slotNumber,
|
|
886
|
-
timestamp,
|
|
887
1419
|
);
|
|
888
1420
|
break;
|
|
889
1421
|
}
|
|
@@ -898,51 +1430,32 @@ export class SequencerPublisher {
|
|
|
898
1430
|
return true;
|
|
899
1431
|
}
|
|
900
1432
|
|
|
901
|
-
/**
|
|
1433
|
+
/** Enqueues a proposal for a checkpoint on L1 */
|
|
902
1434
|
public async enqueueProposeCheckpoint(
|
|
903
1435
|
checkpoint: Checkpoint,
|
|
904
1436
|
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
905
1437
|
attestationsAndSignersSignature: Signature,
|
|
906
|
-
opts:
|
|
1438
|
+
opts: EnqueueProposeCheckpointOpts = {},
|
|
907
1439
|
): Promise<void> {
|
|
908
1440
|
const checkpointHeader = checkpoint.header;
|
|
909
1441
|
|
|
910
1442
|
const blobFields = checkpoint.toBlobFields();
|
|
911
|
-
const blobs = getBlobsPerL1Block(blobFields);
|
|
1443
|
+
const blobs = await getBlobsPerL1Block(blobFields);
|
|
912
1444
|
|
|
913
|
-
const proposeTxArgs = {
|
|
1445
|
+
const proposeTxArgs: L1ProcessArgs = {
|
|
914
1446
|
header: checkpointHeader,
|
|
915
1447
|
archive: checkpoint.archive.root.toBuffer(),
|
|
916
1448
|
blobs,
|
|
917
1449
|
attestationsAndSigners,
|
|
918
1450
|
attestationsAndSignersSignature,
|
|
1451
|
+
feeAssetPriceModifier: checkpoint.feeAssetPriceModifier,
|
|
919
1452
|
};
|
|
920
1453
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
// By simulation issue, I mean the fact that the block.timestamp is equal to the last block, not the next, which
|
|
927
|
-
// make time consistency checks break.
|
|
928
|
-
// TODO(palla): Check whether we're validating twice, once here and once within addProposeTx, since we call simulateProposeTx in both places.
|
|
929
|
-
ts = await this.validateCheckpointForSubmission(
|
|
930
|
-
checkpoint,
|
|
931
|
-
attestationsAndSigners,
|
|
932
|
-
attestationsAndSignersSignature,
|
|
933
|
-
opts,
|
|
934
|
-
);
|
|
935
|
-
} catch (err: any) {
|
|
936
|
-
this.log.error(`Checkpoint validation failed. ${err instanceof Error ? err.message : 'No error message'}`, err, {
|
|
937
|
-
...checkpoint.getStats(),
|
|
938
|
-
slotNumber: checkpoint.header.slotNumber,
|
|
939
|
-
forcePendingCheckpointNumber: opts.forcePendingCheckpointNumber,
|
|
940
|
-
});
|
|
941
|
-
throw err;
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
this.log.verbose(`Enqueuing checkpoint propose transaction`, { ...checkpoint.toCheckpointInfo(), ...opts });
|
|
945
|
-
await this.addProposeTx(checkpoint, proposeTxArgs, opts, ts);
|
|
1454
|
+
this.log.verbose(`Enqueuing checkpoint propose transaction`, {
|
|
1455
|
+
...checkpoint.toCheckpointInfo(),
|
|
1456
|
+
txTimeoutAt: opts.txTimeoutAt,
|
|
1457
|
+
});
|
|
1458
|
+
await this.addProposeTx(checkpoint, proposeTxArgs, { txTimeoutAt: opts.txTimeoutAt });
|
|
946
1459
|
}
|
|
947
1460
|
|
|
948
1461
|
public enqueueInvalidateCheckpoint(
|
|
@@ -953,23 +1466,22 @@ export class SequencerPublisher {
|
|
|
953
1466
|
return;
|
|
954
1467
|
}
|
|
955
1468
|
|
|
956
|
-
// We issued the simulation against the rollup contract, so we need to account for the overhead of the multicall3
|
|
957
|
-
const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil((Number(request.gasUsed) * 64) / 63)));
|
|
958
|
-
|
|
959
1469
|
const { gasUsed, checkpointNumber } = request;
|
|
960
|
-
const logData = { gasUsed, checkpointNumber,
|
|
1470
|
+
const logData = { gasUsed, checkpointNumber, opts };
|
|
961
1471
|
this.log.verbose(`Enqueuing invalidate checkpoint request`, logData);
|
|
962
1472
|
this.addRequest({
|
|
963
1473
|
action: `invalidate-by-${request.reason}`,
|
|
964
1474
|
request: request.request,
|
|
965
|
-
gasConfig: {
|
|
1475
|
+
gasConfig: opts.txTimeoutAt ? { txTimeoutAt: opts.txTimeoutAt } : undefined,
|
|
966
1476
|
lastValidL2Slot: SlotNumber(this.getCurrentL2Slot() + 2),
|
|
967
1477
|
checkSuccess: (_req, result) => {
|
|
968
1478
|
const success =
|
|
969
1479
|
result &&
|
|
970
|
-
result.receipt
|
|
971
|
-
|
|
972
|
-
|
|
1480
|
+
extractEventSuccess(result.receipt, {
|
|
1481
|
+
address: this.rollupContract.address,
|
|
1482
|
+
abi: RollupAbi,
|
|
1483
|
+
eventName: 'CheckpointInvalidated',
|
|
1484
|
+
});
|
|
973
1485
|
if (!success) {
|
|
974
1486
|
this.log.warn(`Invalidate checkpoint ${request.checkpointNumber} failed`, { ...result, ...logData });
|
|
975
1487
|
} else {
|
|
@@ -980,51 +1492,36 @@ export class SequencerPublisher {
|
|
|
980
1492
|
});
|
|
981
1493
|
}
|
|
982
1494
|
|
|
983
|
-
|
|
1495
|
+
/**
|
|
1496
|
+
* Dedup-checked enqueue helper for actions that are simulated at bundle-send time rather
|
|
1497
|
+
* than at enqueue time. Validates the (action, slot) dedup key, sets `lastActions`, and
|
|
1498
|
+
* enqueues without a gasLimit so the bundle simulate sets the only gasLimit that matters.
|
|
1499
|
+
*/
|
|
1500
|
+
private enqueueRequest(
|
|
984
1501
|
action: Action,
|
|
985
1502
|
request: L1TxRequest,
|
|
986
|
-
|
|
1503
|
+
eventOpts: { address: string; abi: Abi; eventName: string },
|
|
987
1504
|
slotNumber: SlotNumber,
|
|
988
|
-
|
|
989
|
-
) {
|
|
990
|
-
const logData = { slotNumber, timestamp, gasLimit: undefined as bigint | undefined };
|
|
1505
|
+
): boolean {
|
|
991
1506
|
if (this.lastActions[action] && this.lastActions[action] === slotNumber) {
|
|
992
1507
|
this.log.debug(`Skipping duplicate action ${action} for slot ${slotNumber}`);
|
|
993
1508
|
return false;
|
|
994
1509
|
}
|
|
995
|
-
|
|
996
1510
|
const cachedLastActionSlot = this.lastActions[action];
|
|
997
1511
|
this.lastActions[action] = slotNumber;
|
|
998
1512
|
|
|
999
|
-
this.log.debug(`
|
|
1000
|
-
|
|
1001
|
-
let gasUsed: bigint;
|
|
1002
|
-
try {
|
|
1003
|
-
({ gasUsed } = await this.l1TxUtils.simulate(request, { time: timestamp }, [], ErrorsAbi)); // TODO(palla/slash): Check the timestamp logic
|
|
1004
|
-
this.log.verbose(`Simulation for ${action} succeeded`, { ...logData, request, gasUsed });
|
|
1005
|
-
} catch (err) {
|
|
1006
|
-
const viemError = formatViemError(err);
|
|
1007
|
-
this.log.error(`Simulation for ${action} at ${slotNumber} failed`, viemError, logData);
|
|
1008
|
-
return false;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
// We issued the simulation against the rollup contract, so we need to account for the overhead of the multicall3
|
|
1012
|
-
const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil((Number(gasUsed) * 64) / 63)));
|
|
1013
|
-
logData.gasLimit = gasLimit;
|
|
1014
|
-
|
|
1015
|
-
this.log.debug(`Enqueuing ${action}`, logData);
|
|
1513
|
+
this.log.debug(`Enqueuing ${action}`, { slotNumber });
|
|
1016
1514
|
this.addRequest({
|
|
1017
1515
|
action,
|
|
1018
1516
|
request,
|
|
1019
|
-
gasConfig: { gasLimit },
|
|
1020
1517
|
lastValidL2Slot: slotNumber,
|
|
1021
|
-
checkSuccess: (
|
|
1022
|
-
const success = result && result.receipt
|
|
1518
|
+
checkSuccess: (_request, result) => {
|
|
1519
|
+
const success = result && extractEventSuccess(result.receipt, eventOpts);
|
|
1023
1520
|
if (!success) {
|
|
1024
|
-
this.log.warn(`Action ${action} at ${slotNumber} failed`, { ...result,
|
|
1521
|
+
this.log.warn(`Action ${action} at ${slotNumber} failed`, { ...result, slotNumber });
|
|
1025
1522
|
this.lastActions[action] = cachedLastActionSlot;
|
|
1026
1523
|
} else {
|
|
1027
|
-
this.log.info(`Action ${action} at ${slotNumber} succeeded`, { ...result,
|
|
1524
|
+
this.log.info(`Action ${action} at ${slotNumber} succeeded`, { ...result, slotNumber });
|
|
1028
1525
|
}
|
|
1029
1526
|
return !!success;
|
|
1030
1527
|
},
|
|
@@ -1040,6 +1537,7 @@ export class SequencerPublisher {
|
|
|
1040
1537
|
*/
|
|
1041
1538
|
public interrupt() {
|
|
1042
1539
|
this.interrupted = true;
|
|
1540
|
+
this.interruptibleSleep.interrupt();
|
|
1043
1541
|
this.l1TxUtils.interrupt();
|
|
1044
1542
|
}
|
|
1045
1543
|
|
|
@@ -1049,11 +1547,7 @@ export class SequencerPublisher {
|
|
|
1049
1547
|
this.l1TxUtils.restart();
|
|
1050
1548
|
}
|
|
1051
1549
|
|
|
1052
|
-
private async prepareProposeTx(
|
|
1053
|
-
encodedData: L1ProcessArgs,
|
|
1054
|
-
timestamp: bigint,
|
|
1055
|
-
options: { forcePendingCheckpointNumber?: CheckpointNumber },
|
|
1056
|
-
) {
|
|
1550
|
+
private async prepareProposeTx(encodedData: L1ProcessArgs) {
|
|
1057
1551
|
const kzg = Blob.getViemKzgInstance();
|
|
1058
1552
|
const blobInput = getPrefixedEthBlobCommitments(encodedData.blobs);
|
|
1059
1553
|
this.log.debug('Validating blob input', { blobInput });
|
|
@@ -1066,7 +1560,11 @@ export class SequencerPublisher {
|
|
|
1066
1560
|
blobEvaluationGas = BigInt(encodedData.blobs.length) * 21_000n;
|
|
1067
1561
|
this.log.debug(`Using fixed blob evaluation gas estimate in fisherman mode: ${blobEvaluationGas}`);
|
|
1068
1562
|
} else {
|
|
1069
|
-
//
|
|
1563
|
+
// We call validateBlobs via estimateGas with real blob+kzg sidecars as a consistency check
|
|
1564
|
+
// that our locally-built blob commitments match the blob data. The bundle simulate at send
|
|
1565
|
+
// time uses eth_simulateV1, which cannot carry blob inputs, so the rollup's on-chain blob
|
|
1566
|
+
// check is forced off there — making this the only pre-flight detector of a commitment/data
|
|
1567
|
+
// mismatch. The returned gas estimate is stashed on the request for the bundle path to read.
|
|
1070
1568
|
blobEvaluationGas = await this.l1TxUtils
|
|
1071
1569
|
.estimateGas(
|
|
1072
1570
|
this.getSenderAddress().toString(),
|
|
@@ -1084,9 +1582,31 @@ export class SequencerPublisher {
|
|
|
1084
1582
|
kzg,
|
|
1085
1583
|
},
|
|
1086
1584
|
)
|
|
1087
|
-
.catch(err => {
|
|
1088
|
-
const
|
|
1089
|
-
this.log.error(`Failed to validate blobs`, message, { metaMessages });
|
|
1585
|
+
.catch(async err => {
|
|
1586
|
+
const viemError = formatViemError(err);
|
|
1587
|
+
this.log.error(`Failed to validate blobs`, viemError.message, { metaMessages: viemError.metaMessages });
|
|
1588
|
+
const validateBlobsData = encodeFunctionData({
|
|
1589
|
+
abi: RollupAbi,
|
|
1590
|
+
functionName: 'validateBlobs',
|
|
1591
|
+
args: [blobInput],
|
|
1592
|
+
});
|
|
1593
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
1594
|
+
this.backupFailedTx(
|
|
1595
|
+
{
|
|
1596
|
+
id: keccak256(validateBlobsData),
|
|
1597
|
+
failureType: 'simulation',
|
|
1598
|
+
request: { to: this.rollupContract.address as Hex, data: validateBlobsData },
|
|
1599
|
+
blobData: encodedData.blobs.map(b => toHex(b.data)) as Hex[],
|
|
1600
|
+
l1BlockNumber,
|
|
1601
|
+
error: { message: viemError.message, name: viemError.name },
|
|
1602
|
+
context: {
|
|
1603
|
+
actions: ['validate-blobs'],
|
|
1604
|
+
sender: this.getSenderAddress().toString(),
|
|
1605
|
+
},
|
|
1606
|
+
timing: this.computeTimingInfo(this.getCurrentL2Slot()),
|
|
1607
|
+
},
|
|
1608
|
+
{ captureFeeSummary: true, targetSlot: this.getCurrentL2Slot() },
|
|
1609
|
+
);
|
|
1090
1610
|
throw new Error('Failed to validate blobs');
|
|
1091
1611
|
});
|
|
1092
1612
|
}
|
|
@@ -1097,8 +1617,7 @@ export class SequencerPublisher {
|
|
|
1097
1617
|
header: encodedData.header.toViem(),
|
|
1098
1618
|
archive: toHex(encodedData.archive),
|
|
1099
1619
|
oracleInput: {
|
|
1100
|
-
|
|
1101
|
-
feeAssetPriceModifier: 0n,
|
|
1620
|
+
feeAssetPriceModifier: encodedData.feeAssetPriceModifier,
|
|
1102
1621
|
},
|
|
1103
1622
|
},
|
|
1104
1623
|
encodedData.attestationsAndSigners.getPackedAttestations(),
|
|
@@ -1107,124 +1626,21 @@ export class SequencerPublisher {
|
|
|
1107
1626
|
blobInput,
|
|
1108
1627
|
] as const;
|
|
1109
1628
|
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1112
|
-
return { args, blobEvaluationGas, rollupData, simulationResult };
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
/**
|
|
1116
|
-
* Simulates the propose tx with eth_simulateV1
|
|
1117
|
-
* @param args - The propose tx args
|
|
1118
|
-
* @param timestamp - The timestamp to simulate proposal at
|
|
1119
|
-
* @returns The simulation result
|
|
1120
|
-
*/
|
|
1121
|
-
private async simulateProposeTx(
|
|
1122
|
-
args: readonly [
|
|
1123
|
-
{
|
|
1124
|
-
readonly header: ViemHeader;
|
|
1125
|
-
readonly archive: `0x${string}`;
|
|
1126
|
-
readonly oracleInput: {
|
|
1127
|
-
readonly feeAssetPriceModifier: 0n;
|
|
1128
|
-
};
|
|
1129
|
-
},
|
|
1130
|
-
ViemCommitteeAttestations,
|
|
1131
|
-
`0x${string}`[], // Signers
|
|
1132
|
-
ViemSignature,
|
|
1133
|
-
`0x${string}`,
|
|
1134
|
-
],
|
|
1135
|
-
timestamp: bigint,
|
|
1136
|
-
options: { forcePendingCheckpointNumber?: CheckpointNumber },
|
|
1137
|
-
) {
|
|
1138
|
-
const rollupData = encodeFunctionData({
|
|
1139
|
-
abi: RollupAbi,
|
|
1140
|
-
functionName: 'propose',
|
|
1141
|
-
args,
|
|
1142
|
-
});
|
|
1143
|
-
|
|
1144
|
-
// override the pending checkpoint number if requested
|
|
1145
|
-
const forcePendingCheckpointNumberStateDiff = (
|
|
1146
|
-
options.forcePendingCheckpointNumber !== undefined
|
|
1147
|
-
? await this.rollupContract.makePendingCheckpointNumberOverride(options.forcePendingCheckpointNumber)
|
|
1148
|
-
: []
|
|
1149
|
-
).flatMap(override => override.stateDiff ?? []);
|
|
1150
|
-
|
|
1151
|
-
const stateOverrides: StateOverride = [
|
|
1152
|
-
{
|
|
1153
|
-
address: this.rollupContract.address,
|
|
1154
|
-
// @note we override checkBlob to false since blobs are not part simulate()
|
|
1155
|
-
stateDiff: [
|
|
1156
|
-
{ slot: toPaddedHex(RollupContract.checkBlobStorageSlot, true), value: toPaddedHex(0n, true) },
|
|
1157
|
-
...forcePendingCheckpointNumberStateDiff,
|
|
1158
|
-
],
|
|
1159
|
-
},
|
|
1160
|
-
];
|
|
1161
|
-
// In fisherman mode, simulate as the proposer but with sufficient balance
|
|
1162
|
-
if (this.proposerAddressForSimulation) {
|
|
1163
|
-
stateOverrides.push({
|
|
1164
|
-
address: this.proposerAddressForSimulation.toString(),
|
|
1165
|
-
balance: 10n * WEI_CONST * WEI_CONST, // 10 ETH
|
|
1166
|
-
});
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
const simulationResult = await this.l1TxUtils
|
|
1170
|
-
.simulate(
|
|
1171
|
-
{
|
|
1172
|
-
to: this.rollupContract.address,
|
|
1173
|
-
data: rollupData,
|
|
1174
|
-
gas: SequencerPublisher.PROPOSE_GAS_GUESS,
|
|
1175
|
-
...(this.proposerAddressForSimulation && { from: this.proposerAddressForSimulation.toString() }),
|
|
1176
|
-
},
|
|
1177
|
-
{
|
|
1178
|
-
// @note we add 1n to the timestamp because geth implementation doesn't like simulation timestamp to be equal to the current block timestamp
|
|
1179
|
-
time: timestamp + 1n,
|
|
1180
|
-
// @note reth should have a 30m gas limit per block but throws errors that this tx is beyond limit so we increase here
|
|
1181
|
-
gasLimit: SequencerPublisher.PROPOSE_GAS_GUESS * 2n,
|
|
1182
|
-
},
|
|
1183
|
-
stateOverrides,
|
|
1184
|
-
RollupAbi,
|
|
1185
|
-
{
|
|
1186
|
-
// @note fallback gas estimate to use if the node doesn't support simulation API
|
|
1187
|
-
fallbackGasEstimate: SequencerPublisher.PROPOSE_GAS_GUESS,
|
|
1188
|
-
},
|
|
1189
|
-
)
|
|
1190
|
-
.catch(err => {
|
|
1191
|
-
// In fisherman mode, we expect ValidatorSelection__MissingProposerSignature since fisherman doesn't have proposer signature
|
|
1192
|
-
const viemError = formatViemError(err);
|
|
1193
|
-
if (this.config.fishermanMode && viemError.message?.includes('ValidatorSelection__MissingProposerSignature')) {
|
|
1194
|
-
this.log.debug(`Ignoring expected ValidatorSelection__MissingProposerSignature error in fisherman mode`);
|
|
1195
|
-
// Return a minimal simulation result with the fallback gas estimate
|
|
1196
|
-
return {
|
|
1197
|
-
gasUsed: SequencerPublisher.PROPOSE_GAS_GUESS,
|
|
1198
|
-
logs: [],
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
this.log.error(`Failed to simulate propose tx`, viemError);
|
|
1202
|
-
throw err;
|
|
1203
|
-
});
|
|
1629
|
+
const rollupData = encodeFunctionData({ abi: RollupAbi, functionName: 'propose', args });
|
|
1204
1630
|
|
|
1205
|
-
return {
|
|
1631
|
+
return { args, blobEvaluationGas, rollupData };
|
|
1206
1632
|
}
|
|
1207
1633
|
|
|
1208
1634
|
private async addProposeTx(
|
|
1209
1635
|
checkpoint: Checkpoint,
|
|
1210
1636
|
encodedData: L1ProcessArgs,
|
|
1211
|
-
opts:
|
|
1212
|
-
timestamp: bigint,
|
|
1637
|
+
opts: EnqueueProposeCheckpointOpts = {},
|
|
1213
1638
|
): Promise<void> {
|
|
1214
1639
|
const slot = checkpoint.header.slotNumber;
|
|
1215
1640
|
const timer = new Timer();
|
|
1216
1641
|
const kzg = Blob.getViemKzgInstance();
|
|
1217
|
-
const { rollupData,
|
|
1218
|
-
encodedData,
|
|
1219
|
-
timestamp,
|
|
1220
|
-
opts,
|
|
1221
|
-
);
|
|
1642
|
+
const { rollupData, blobEvaluationGas } = await this.prepareProposeTx(encodedData);
|
|
1222
1643
|
const startBlock = await this.l1TxUtils.getBlockNumber();
|
|
1223
|
-
const gasLimit = this.l1TxUtils.bumpGasLimit(
|
|
1224
|
-
BigInt(Math.ceil((Number(simulationResult.gasUsed) * 64) / 63)) +
|
|
1225
|
-
blobEvaluationGas +
|
|
1226
|
-
SequencerPublisher.MULTICALL_OVERHEAD_GAS_GUESS, // We issue the simulation against the rollup contract, so we need to account for the overhead of the multicall3
|
|
1227
|
-
);
|
|
1228
1644
|
|
|
1229
1645
|
// Send the blobs to the blob client preemptively. This helps in tests where the sequencer mistakingly thinks that the propose
|
|
1230
1646
|
// tx fails but it does get mined. We make sure that the blobs are sent to the blob client regardless of the tx outcome.
|
|
@@ -1241,7 +1657,8 @@ export class SequencerPublisher {
|
|
|
1241
1657
|
data: rollupData,
|
|
1242
1658
|
},
|
|
1243
1659
|
lastValidL2Slot: checkpoint.header.slotNumber,
|
|
1244
|
-
gasConfig: {
|
|
1660
|
+
gasConfig: { txTimeoutAt: opts.txTimeoutAt, gasLimit: undefined },
|
|
1661
|
+
blobEvaluationGas,
|
|
1245
1662
|
blobConfig: {
|
|
1246
1663
|
blobs: encodedData.blobs.map(b => b.data),
|
|
1247
1664
|
kzg,
|
|
@@ -1251,10 +1668,11 @@ export class SequencerPublisher {
|
|
|
1251
1668
|
return false;
|
|
1252
1669
|
}
|
|
1253
1670
|
const { receipt, stats, errorMsg } = result;
|
|
1254
|
-
const success =
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1671
|
+
const success = extractEventSuccess(receipt, {
|
|
1672
|
+
address: this.rollupContract.address,
|
|
1673
|
+
abi: RollupAbi,
|
|
1674
|
+
eventName: 'CheckpointProposed',
|
|
1675
|
+
});
|
|
1258
1676
|
|
|
1259
1677
|
if (success) {
|
|
1260
1678
|
const endBlock = receipt.blockNumber;
|
|
@@ -1294,4 +1712,10 @@ export class SequencerPublisher {
|
|
|
1294
1712
|
},
|
|
1295
1713
|
});
|
|
1296
1714
|
}
|
|
1715
|
+
|
|
1716
|
+
/** Returns the timestamp of the next L1 slot boundary after now. */
|
|
1717
|
+
private getNextL1SlotTimestamp(): bigint {
|
|
1718
|
+
const l1Constants = this.epochCache.getL1Constants();
|
|
1719
|
+
return getNextL1SlotTimestamp(this.dateProvider.nowInSeconds(), l1Constants);
|
|
1720
|
+
}
|
|
1297
1721
|
}
|