@aztec/sequencer-client 0.0.1-commit.9ef841308 → 0.0.1-commit.a5db02d
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 +20 -5
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +26 -22
- package/dest/config.d.ts +11 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +55 -26
- 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 +6 -25
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +7 -65
- package/dest/global_variable_builder/index.d.ts +3 -1
- 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 +7 -3
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +13 -3
- 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/failed_tx_store.d.ts +3 -4
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -1
- 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 +1 -3
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +0 -1
- package/dest/publisher/sequencer-publisher.d.ts +80 -66
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +395 -532
- 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 +690 -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 +71 -21
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +724 -212
- 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/errors.d.ts +1 -8
- package/dest/sequencer/errors.d.ts.map +1 -1
- package/dest/sequencer/errors.js +0 -9
- package/dest/sequencer/events.d.ts +61 -5
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/metrics.d.ts +9 -10
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +34 -20
- 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 +155 -33
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +543 -158
- package/dest/sequencer/types.d.ts +2 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/index.d.ts +3 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/utils.d.ts +15 -1
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +25 -7
- package/package.json +28 -27
- package/src/client/sequencer-client.ts +37 -27
- package/src/config.ts +64 -26
- 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 +12 -80
- package/src/global_variable_builder/index.ts +2 -0
- package/src/publisher/config.ts +30 -7
- package/src/publisher/l1_to_l2_messaging.ts +85 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +3 -1
- package/src/publisher/sequencer-bundle-simulator.ts +254 -0
- package/src/publisher/sequencer-publisher-factory.ts +0 -3
- package/src/publisher/sequencer-publisher.ts +453 -567
- package/src/publisher/write_json.ts +78 -0
- package/src/sequencer/automine/README.md +60 -0
- package/src/sequencer/automine/automine_factory.ts +152 -0
- package/src/sequencer/automine/automine_sequencer.ts +796 -0
- package/src/sequencer/automine/index.ts +6 -0
- package/src/sequencer/checkpoint_proposal_job.ts +844 -241
- package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
- package/src/sequencer/errors.ts +0 -15
- package/src/sequencer/events.ts +66 -5
- package/src/sequencer/metrics.ts +43 -24
- package/src/sequencer/requests_tracker.ts +43 -0
- package/src/sequencer/sequencer.ts +625 -175
- package/src/sequencer/types.ts +1 -1
- package/src/test/index.ts +2 -2
- package/src/test/utils.ts +61 -10
- package/dest/sequencer/timetable.d.ts +0 -88
- package/dest/sequencer/timetable.d.ts.map +0 -1
- package/dest/sequencer/timetable.js +0 -222
- package/src/sequencer/README.md +0 -531
- package/src/sequencer/timetable.ts +0 -283
|
@@ -3,16 +3,15 @@ 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
|
-
type EmpireSlashingProposerContract,
|
|
7
6
|
FeeAssetPriceOracle,
|
|
8
7
|
type GovernanceProposerContract,
|
|
9
|
-
type IEmpireBase,
|
|
10
8
|
MULTI_CALL_3_ADDRESS,
|
|
11
9
|
Multicall3,
|
|
12
|
-
|
|
13
|
-
type
|
|
14
|
-
type
|
|
15
|
-
type
|
|
10
|
+
MulticallForwarderRevertedError,
|
|
11
|
+
type RollupContract,
|
|
12
|
+
type SimulationOverridesPlan,
|
|
13
|
+
type SlashingProposerContract,
|
|
14
|
+
buildSimulationOverridesStateOverride,
|
|
16
15
|
} from '@aztec/ethereum/contracts';
|
|
17
16
|
import { type L1FeeAnalysisResult, L1FeeAnalyzer } from '@aztec/ethereum/l1-fee-analysis';
|
|
18
17
|
import {
|
|
@@ -24,45 +23,81 @@ import {
|
|
|
24
23
|
type TransactionStats,
|
|
25
24
|
WEI_CONST,
|
|
26
25
|
} from '@aztec/ethereum/l1-tx-utils';
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
import {
|
|
27
|
+
FormattedViemError,
|
|
28
|
+
formatViemError,
|
|
29
|
+
mergeAbis,
|
|
30
|
+
tryDecodeRevertReason,
|
|
31
|
+
tryExtractEvent,
|
|
32
|
+
} from '@aztec/ethereum/utils';
|
|
30
33
|
import { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
31
34
|
import { trimmedBytesLength } from '@aztec/foundation/buffer';
|
|
32
35
|
import { pick } from '@aztec/foundation/collection';
|
|
33
36
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
34
37
|
import { TimeoutError } from '@aztec/foundation/error';
|
|
35
38
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
36
|
-
import { Signature
|
|
39
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
37
40
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
38
|
-
import {
|
|
41
|
+
import { InterruptibleSleep } from '@aztec/foundation/sleep';
|
|
39
42
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
40
|
-
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
41
|
-
import { EmpireBaseAbi, ErrorsAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
43
|
+
import { type DateProvider, Timer } from '@aztec/foundation/timer';
|
|
44
|
+
import { EmpireBaseAbi, ErrorsAbi, RollupAbi, SlashingProposerAbi } from '@aztec/l1-artifacts';
|
|
42
45
|
import { type ProposerSlashAction, encodeSlashConsensusVotes } from '@aztec/slasher';
|
|
43
46
|
import { CommitteeAttestationsAndSigners, type ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
44
47
|
import type { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
45
|
-
import {
|
|
46
|
-
|
|
48
|
+
import {
|
|
49
|
+
getLastL1SlotTimestampForL2Slot,
|
|
50
|
+
getNextL1SlotTimestamp,
|
|
51
|
+
getTimestampForSlot,
|
|
52
|
+
} from '@aztec/stdlib/epoch-helpers';
|
|
47
53
|
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
48
54
|
import type { L1PublishCheckpointStats } from '@aztec/stdlib/stats';
|
|
49
55
|
import { type TelemetryClient, type Tracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
50
56
|
|
|
51
57
|
import {
|
|
58
|
+
type Abi,
|
|
52
59
|
type Hex,
|
|
53
|
-
type StateOverride,
|
|
54
60
|
type TransactionReceipt,
|
|
55
61
|
type TypedDataDefinition,
|
|
56
62
|
encodeFunctionData,
|
|
57
63
|
keccak256,
|
|
58
|
-
multicall3Abi,
|
|
59
64
|
toHex,
|
|
60
65
|
} from 'viem';
|
|
61
66
|
|
|
62
67
|
import type { SequencerPublisherConfig } from './config.js';
|
|
63
68
|
import { type FailedL1Tx, type L1TxFailedStore, createL1TxFailedStore } from './l1_tx_failed_store/index.js';
|
|
69
|
+
import { type DroppedRequest, SequencerBundleSimulator } from './sequencer-bundle-simulator.js';
|
|
64
70
|
import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
65
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Returns true if the receipt indicates a successful send AND the expected event was emitted
|
|
74
|
+
* by the target contract. Both pieces are required: an aggregate3 entry that reverted will
|
|
75
|
+
* have receipt.status === 'success' but no event log.
|
|
76
|
+
*/
|
|
77
|
+
function extractEventSuccess(
|
|
78
|
+
receipt: TransactionReceipt | undefined,
|
|
79
|
+
opts: { address: string; abi: Abi; eventName: string },
|
|
80
|
+
): boolean {
|
|
81
|
+
if (!receipt || receipt.status !== 'success') {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
return !!tryExtractEvent(receipt.logs, opts.address.toString() as Hex, opts.abi, opts.eventName);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Result of a sendRequests call, returned by both sendRequests() and sendRequestsAt(). */
|
|
88
|
+
export type SendRequestsResult = {
|
|
89
|
+
/** The L1 transaction receipt from the bundled multicall. */
|
|
90
|
+
result: { receipt: TransactionReceipt };
|
|
91
|
+
/** Actions that expired (past their deadline) before the request was sent. */
|
|
92
|
+
expiredActions: Action[];
|
|
93
|
+
/** Actions that were included in the sent L1 transaction. */
|
|
94
|
+
sentActions: Action[];
|
|
95
|
+
/** Actions whose L1 simulation succeeded (subset of sentActions). */
|
|
96
|
+
successfulActions: Action[];
|
|
97
|
+
/** Actions whose L1 simulation failed (subset of sentActions). */
|
|
98
|
+
failedActions: Action[];
|
|
99
|
+
};
|
|
100
|
+
|
|
66
101
|
/** Arguments to the process method of the rollup contract */
|
|
67
102
|
type L1ProcessArgs = {
|
|
68
103
|
/** The L2 block header. */
|
|
@@ -82,18 +117,16 @@ type L1ProcessArgs = {
|
|
|
82
117
|
export const Actions = [
|
|
83
118
|
'invalidate-by-invalid-attestation',
|
|
84
119
|
'invalidate-by-insufficient-attestations',
|
|
120
|
+
'prune',
|
|
85
121
|
'propose',
|
|
86
122
|
'governance-signal',
|
|
87
|
-
'empire-slashing-signal',
|
|
88
|
-
'create-empire-payload',
|
|
89
|
-
'execute-empire-payload',
|
|
90
123
|
'vote-offenses',
|
|
91
124
|
'execute-slash',
|
|
92
125
|
] as const;
|
|
93
126
|
|
|
94
127
|
export type Action = (typeof Actions)[number];
|
|
95
128
|
|
|
96
|
-
type GovernanceSignalAction = Extract<Action, 'governance-signal'
|
|
129
|
+
type GovernanceSignalAction = Extract<Action, 'governance-signal'>;
|
|
97
130
|
|
|
98
131
|
// Sorting for actions such that invalidations go before proposals, and proposals go before votes
|
|
99
132
|
export const compareActions = (a: Action, b: Action) => Actions.indexOf(a) - Actions.indexOf(b);
|
|
@@ -104,14 +137,22 @@ export type InvalidateCheckpointRequest = {
|
|
|
104
137
|
gasUsed: bigint;
|
|
105
138
|
checkpointNumber: CheckpointNumber;
|
|
106
139
|
forcePendingCheckpointNumber: CheckpointNumber;
|
|
140
|
+
/** Archive at the rollback target checkpoint (checkpoint N-1). */
|
|
141
|
+
lastArchive: Fr;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
type EnqueueProposeCheckpointOpts = {
|
|
145
|
+
txTimeoutAt?: Date;
|
|
107
146
|
};
|
|
108
147
|
|
|
109
|
-
interface RequestWithExpiry {
|
|
148
|
+
export interface RequestWithExpiry {
|
|
110
149
|
action: Action;
|
|
111
150
|
request: L1TxRequest;
|
|
112
151
|
lastValidL2Slot: SlotNumber;
|
|
113
152
|
gasConfig?: Pick<L1TxConfig, 'txTimeoutAt' | 'gasLimit'>;
|
|
114
153
|
blobConfig?: L1BlobInputs;
|
|
154
|
+
/** Gas consumed by validateBlobs; stashed for the bundle simulate at send time. */
|
|
155
|
+
blobEvaluationGas?: bigint;
|
|
115
156
|
checkSuccess: (
|
|
116
157
|
request: L1TxRequest,
|
|
117
158
|
result?: { receipt: TransactionReceipt; stats?: TransactionStats; errorMsg?: string },
|
|
@@ -121,26 +162,29 @@ interface RequestWithExpiry {
|
|
|
121
162
|
export class SequencerPublisher {
|
|
122
163
|
private interrupted = false;
|
|
123
164
|
private metrics: SequencerPublisherMetrics;
|
|
165
|
+
private bundleSimulator: SequencerBundleSimulator;
|
|
124
166
|
public epochCache: EpochCache;
|
|
125
167
|
private failedTxStore?: Promise<L1TxFailedStore | undefined>;
|
|
126
168
|
|
|
127
|
-
|
|
128
|
-
|
|
169
|
+
/**
|
|
170
|
+
* ABI used to decode raw revert payloads from dropped bundle entries when the original
|
|
171
|
+
* request did not carry an abi (e.g. the propose request). Merges every contract the
|
|
172
|
+
* publisher can route to so any of their custom errors decode against it.
|
|
173
|
+
*/
|
|
174
|
+
private readonly revertDecoderAbi: Abi = mergeAbis([RollupAbi, SlashingProposerAbi, EmpireBaseAbi, ErrorsAbi]);
|
|
129
175
|
|
|
130
176
|
protected lastActions: Partial<Record<Action, SlotNumber>> = {};
|
|
131
177
|
|
|
132
|
-
private isPayloadEmptyCache: Map<string, boolean> = new Map<string, boolean>();
|
|
133
|
-
private payloadProposedCache: Set<string> = new Set<string>();
|
|
134
|
-
|
|
135
178
|
protected log: Logger;
|
|
136
179
|
protected ethereumSlotDuration: bigint;
|
|
137
180
|
protected aztecSlotDuration: bigint;
|
|
138
|
-
private
|
|
181
|
+
private readonly previousL1BlockWaitTimeoutMs: number;
|
|
182
|
+
private readonly previousL1BlockWaitPollIntervalMs: number;
|
|
139
183
|
|
|
140
|
-
|
|
184
|
+
/** Date provider for wall-clock time. */
|
|
185
|
+
private readonly dateProvider: DateProvider;
|
|
141
186
|
|
|
142
|
-
|
|
143
|
-
private proposerAddressForSimulation?: EthAddress;
|
|
187
|
+
private blobClient: BlobClientInterface;
|
|
144
188
|
|
|
145
189
|
/** Optional callback to obtain a replacement publisher when the current one fails to send. */
|
|
146
190
|
private getNextPublisher?: (excludeAddresses: EthAddress[]) => Promise<L1TxUtils | undefined>;
|
|
@@ -151,33 +195,34 @@ export class SequencerPublisher {
|
|
|
151
195
|
/** Fee asset price oracle for computing price modifiers from Uniswap V4 */
|
|
152
196
|
private feeAssetPriceOracle: FeeAssetPriceOracle;
|
|
153
197
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// Gas report for VotingWithSigTest shows a max gas of 100k, but we've seen it cost 700k+ in testnet
|
|
158
|
-
public static VOTE_GAS_GUESS: bigint = 800_000n;
|
|
198
|
+
/** Interruptible sleep used by sendRequestsAt to wait until a target timestamp. */
|
|
199
|
+
private readonly interruptibleSleep = new InterruptibleSleep();
|
|
159
200
|
|
|
160
201
|
public l1TxUtils: L1TxUtils;
|
|
161
202
|
public rollupContract: RollupContract;
|
|
162
203
|
public govProposerContract: GovernanceProposerContract;
|
|
163
|
-
public slashingProposerContract:
|
|
164
|
-
public slashFactoryContract: SlashFactoryContract;
|
|
204
|
+
public slashingProposerContract: SlashingProposerContract | undefined;
|
|
165
205
|
|
|
166
206
|
public readonly tracer: Tracer;
|
|
167
207
|
|
|
168
208
|
protected requests: RequestWithExpiry[] = [];
|
|
169
209
|
|
|
170
210
|
constructor(
|
|
171
|
-
private config: Pick<
|
|
211
|
+
private config: Pick<
|
|
212
|
+
SequencerPublisherConfig,
|
|
213
|
+
| 'fishermanMode'
|
|
214
|
+
| 'l1TxFailedStore'
|
|
215
|
+
| 'sequencerPublisherPreviousL1BlockWaitTimeoutMs'
|
|
216
|
+
| 'sequencerPublisherPreviousL1BlockWaitPollIntervalMs'
|
|
217
|
+
> &
|
|
172
218
|
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration'> & { l1ChainId: number },
|
|
173
219
|
deps: {
|
|
174
220
|
telemetry?: TelemetryClient;
|
|
175
221
|
blobClient: BlobClientInterface;
|
|
176
222
|
l1TxUtils: L1TxUtils;
|
|
177
223
|
rollupContract: RollupContract;
|
|
178
|
-
slashingProposerContract:
|
|
224
|
+
slashingProposerContract: SlashingProposerContract | undefined;
|
|
179
225
|
governanceProposerContract: GovernanceProposerContract;
|
|
180
|
-
slashFactoryContract: SlashFactoryContract;
|
|
181
226
|
epochCache: EpochCache;
|
|
182
227
|
dateProvider: DateProvider;
|
|
183
228
|
metrics: SequencerPublisherMetrics;
|
|
@@ -189,11 +234,14 @@ export class SequencerPublisher {
|
|
|
189
234
|
this.log = deps.log ?? createLogger('sequencer:publisher');
|
|
190
235
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
191
236
|
this.aztecSlotDuration = BigInt(config.aztecSlotDuration);
|
|
237
|
+
this.previousL1BlockWaitTimeoutMs = config.sequencerPublisherPreviousL1BlockWaitTimeoutMs;
|
|
238
|
+
this.previousL1BlockWaitPollIntervalMs = config.sequencerPublisherPreviousL1BlockWaitPollIntervalMs;
|
|
192
239
|
this.dateProvider = deps.dateProvider;
|
|
193
240
|
this.epochCache = deps.epochCache;
|
|
194
241
|
this.lastActions = deps.lastActions;
|
|
195
242
|
|
|
196
243
|
this.blobClient = deps.blobClient;
|
|
244
|
+
this.dateProvider = deps.dateProvider;
|
|
197
245
|
|
|
198
246
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
199
247
|
this.metrics = deps.metrics ?? new SequencerPublisherMetrics(telemetry, 'SequencerPublisher');
|
|
@@ -211,14 +259,12 @@ export class SequencerPublisher {
|
|
|
211
259
|
const newSlashingProposer = await this.rollupContract.getSlashingProposer();
|
|
212
260
|
this.slashingProposerContract = newSlashingProposer;
|
|
213
261
|
});
|
|
214
|
-
this.slashFactoryContract = deps.slashFactoryContract;
|
|
215
|
-
|
|
216
262
|
// Initialize L1 fee analyzer for fisherman mode
|
|
217
263
|
if (config.fishermanMode) {
|
|
218
264
|
this.l1FeeAnalyzer = new L1FeeAnalyzer(
|
|
219
265
|
this.l1TxUtils.client,
|
|
220
266
|
deps.dateProvider,
|
|
221
|
-
|
|
267
|
+
this.log.createChild('fee-analyzer'),
|
|
222
268
|
);
|
|
223
269
|
}
|
|
224
270
|
|
|
@@ -226,11 +272,18 @@ export class SequencerPublisher {
|
|
|
226
272
|
this.feeAssetPriceOracle = new FeeAssetPriceOracle(
|
|
227
273
|
this.l1TxUtils.client,
|
|
228
274
|
this.rollupContract,
|
|
229
|
-
|
|
275
|
+
this.log.createChild('price-oracle'),
|
|
230
276
|
);
|
|
231
277
|
|
|
232
278
|
// Initialize failed L1 tx store (optional, for test networks)
|
|
233
279
|
this.failedTxStore = createL1TxFailedStore(config.l1TxFailedStore, this.log);
|
|
280
|
+
|
|
281
|
+
this.bundleSimulator = new SequencerBundleSimulator({
|
|
282
|
+
getL1TxUtils: () => this.l1TxUtils,
|
|
283
|
+
rollupContract: this.rollupContract,
|
|
284
|
+
epochCache: this.epochCache,
|
|
285
|
+
log: this.log.createChild('bundle-simulator'),
|
|
286
|
+
});
|
|
234
287
|
}
|
|
235
288
|
|
|
236
289
|
/**
|
|
@@ -261,10 +314,14 @@ export class SequencerPublisher {
|
|
|
261
314
|
|
|
262
315
|
/**
|
|
263
316
|
* Gets the fee asset price modifier from the oracle.
|
|
264
|
-
*
|
|
317
|
+
*
|
|
318
|
+
* @param predictedParentEthPerFeeAssetE12 - Optional predicted parent eth-per-fee-asset (E12).
|
|
319
|
+
* Pipelined proposers should pass the value from the predicted parent fee header so the
|
|
320
|
+
* modifier matches the parent L1 will use when applying it.
|
|
321
|
+
* @returns The fee asset price modifier in basis points, or 0n if the oracle query fails.
|
|
265
322
|
*/
|
|
266
|
-
public getFeeAssetPriceModifier(): Promise<bigint> {
|
|
267
|
-
return this.feeAssetPriceOracle.computePriceModifier();
|
|
323
|
+
public getFeeAssetPriceModifier(predictedParentEthPerFeeAssetE12?: bigint): Promise<bigint> {
|
|
324
|
+
return this.feeAssetPriceOracle.computePriceModifier(predictedParentEthPerFeeAssetE12);
|
|
268
325
|
}
|
|
269
326
|
|
|
270
327
|
public getSenderAddress() {
|
|
@@ -278,14 +335,6 @@ export class SequencerPublisher {
|
|
|
278
335
|
return this.l1FeeAnalyzer;
|
|
279
336
|
}
|
|
280
337
|
|
|
281
|
-
/**
|
|
282
|
-
* Sets the proposer address to use for simulations in fisherman mode.
|
|
283
|
-
* @param proposerAddress - The actual proposer's address to use for balance lookups in simulations
|
|
284
|
-
*/
|
|
285
|
-
public setProposerAddressForSimulation(proposerAddress: EthAddress | undefined) {
|
|
286
|
-
this.proposerAddressForSimulation = proposerAddress;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
338
|
public addRequest(request: RequestWithExpiry) {
|
|
290
339
|
this.requests.push(request);
|
|
291
340
|
}
|
|
@@ -363,22 +412,26 @@ export class SequencerPublisher {
|
|
|
363
412
|
|
|
364
413
|
/**
|
|
365
414
|
* Sends all requests that are still valid.
|
|
415
|
+
* @param targetSlot - The target L2 slot for this send. When provided (the production path, via
|
|
416
|
+
* sendRequestsAt), it is threaded into bundleSimulate so the block.timestamp override matches
|
|
417
|
+
* the slot the propose is built for. When omitted, falls back to getCurrentL2Slot() for the
|
|
418
|
+
* AutomineSequencer, which publishes synchronously within the current slot.
|
|
366
419
|
* @returns one of:
|
|
367
420
|
* - A receipt and stats if the tx succeeded
|
|
368
421
|
* - a receipt and errorMsg if it failed on L1
|
|
369
422
|
* - undefined if no valid requests are found OR the tx failed to send.
|
|
370
423
|
*/
|
|
371
424
|
@trackSpan('SequencerPublisher.sendRequests')
|
|
372
|
-
public async sendRequests() {
|
|
425
|
+
public async sendRequests(targetSlot?: SlotNumber): Promise<SendRequestsResult | undefined> {
|
|
373
426
|
const requestsToProcess = [...this.requests];
|
|
374
427
|
this.requests = [];
|
|
428
|
+
|
|
375
429
|
if (this.interrupted || requestsToProcess.length === 0) {
|
|
376
430
|
return undefined;
|
|
377
431
|
}
|
|
378
|
-
const currentL2Slot = this.getCurrentL2Slot();
|
|
432
|
+
const currentL2Slot = targetSlot ?? this.getCurrentL2Slot();
|
|
379
433
|
this.log.debug(`Sending requests on L2 slot ${currentL2Slot}`);
|
|
380
434
|
const validRequests = requestsToProcess.filter(request => request.lastValidL2Slot >= currentL2Slot);
|
|
381
|
-
const validActions = validRequests.map(x => x.action);
|
|
382
435
|
const expiredActions = requestsToProcess
|
|
383
436
|
.filter(request => request.lastValidL2Slot < currentL2Slot)
|
|
384
437
|
.map(x => x.action);
|
|
@@ -401,70 +454,60 @@ export class SequencerPublisher {
|
|
|
401
454
|
return undefined;
|
|
402
455
|
}
|
|
403
456
|
|
|
404
|
-
//
|
|
405
|
-
// find requests with gas and blob configs
|
|
406
|
-
// See https://github.com/AztecProtocol/aztec-packages/issues/11513
|
|
457
|
+
// Collect earliest txTimeoutAt across all requests.
|
|
407
458
|
const gasConfigs = validRequests.filter(request => request.gasConfig).map(request => request.gasConfig);
|
|
408
|
-
const blobConfigs = validRequests.filter(request => request.blobConfig).map(request => request.blobConfig);
|
|
409
|
-
|
|
410
|
-
if (blobConfigs.length > 1) {
|
|
411
|
-
throw new Error('Multiple blob configs found');
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
const blobConfig = blobConfigs[0];
|
|
415
|
-
|
|
416
|
-
// Merge gasConfigs. Yields the sum of gasLimits, and the earliest txTimeoutAt, or undefined if no gasConfig sets them.
|
|
417
|
-
const gasLimits = gasConfigs.map(g => g?.gasLimit).filter((g): g is bigint => g !== undefined);
|
|
418
|
-
let gasLimit = gasLimits.length > 0 ? sumBigint(gasLimits) : undefined; // sum
|
|
419
|
-
// Cap at L1 block gas limit so the node accepts the tx ("gas limit too high" otherwise).
|
|
420
|
-
const maxGas = MAX_L1_TX_LIMIT;
|
|
421
|
-
if (gasLimit !== undefined && gasLimit > maxGas) {
|
|
422
|
-
this.log.debug('Capping bundled tx gas limit to L1 max', {
|
|
423
|
-
requested: gasLimit,
|
|
424
|
-
capped: maxGas,
|
|
425
|
-
});
|
|
426
|
-
gasLimit = maxGas;
|
|
427
|
-
}
|
|
428
459
|
const txTimeoutAts = gasConfigs.map(g => g?.txTimeoutAt).filter((g): g is Date => g !== undefined);
|
|
429
|
-
const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map(g => g.getTime()))) : undefined;
|
|
430
|
-
const txConfig: RequestWithExpiry['gasConfig'] = { gasLimit, txTimeoutAt };
|
|
460
|
+
const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map(g => g.getTime()))) : undefined;
|
|
431
461
|
|
|
432
462
|
// Sort the requests so that proposals always go first
|
|
433
463
|
// This ensures the committee gets precomputed correctly
|
|
434
464
|
validRequests.sort((a, b) => compareActions(a.action, b.action));
|
|
435
465
|
|
|
436
466
|
try {
|
|
437
|
-
//
|
|
438
|
-
const
|
|
439
|
-
const multicallData = encodeFunctionData({
|
|
440
|
-
abi: multicall3Abi,
|
|
441
|
-
functionName: 'aggregate3',
|
|
442
|
-
args: [
|
|
443
|
-
validRequests.map(r => ({
|
|
444
|
-
target: r.request.to!,
|
|
445
|
-
callData: r.request.data!,
|
|
446
|
-
allowFailure: true,
|
|
447
|
-
})),
|
|
448
|
-
],
|
|
449
|
-
});
|
|
450
|
-
const blobDataHex = blobConfig?.blobs?.map(b => toHex(b)) as Hex[] | undefined;
|
|
467
|
+
// Bundle-level eth_simulateV1: filters out entries that revert and derives the gasLimit.
|
|
468
|
+
const bundleResult = await this.bundleSimulator.simulate(validRequests, currentL2Slot);
|
|
451
469
|
|
|
452
|
-
|
|
470
|
+
if (bundleResult.kind === 'aborted') {
|
|
471
|
+
this.logDroppedInSim(bundleResult.droppedRequests);
|
|
472
|
+
void this.backupDroppedInSim(bundleResult.droppedRequests).catch(err =>
|
|
473
|
+
this.log.error(`Failed to backup requests dropped in simulation`, err),
|
|
474
|
+
);
|
|
475
|
+
return undefined;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const { requests, droppedRequests, gasLimit } =
|
|
479
|
+
bundleResult.kind === 'fallback'
|
|
480
|
+
? {
|
|
481
|
+
requests: bundleResult.requests,
|
|
482
|
+
droppedRequests: bundleResult.droppedRequests,
|
|
483
|
+
gasLimit: MAX_L1_TX_LIMIT,
|
|
484
|
+
}
|
|
485
|
+
: bundleResult;
|
|
486
|
+
|
|
487
|
+
this.logDroppedInSim(droppedRequests);
|
|
488
|
+
|
|
489
|
+
// Compute blobConfig from survivors (not original validRequests) so that if the propose
|
|
490
|
+
// entry was dropped by bundleSimulate we don't attach a blob-typed config to a non-blob tx.
|
|
491
|
+
const [blobConfig] = requests.filter(r => r.blobConfig).map(r => r.blobConfig);
|
|
492
|
+
const txConfig: RequestWithExpiry['gasConfig'] = { gasLimit, txTimeoutAt };
|
|
453
493
|
|
|
454
494
|
this.log.debug('Forwarding transactions', {
|
|
455
|
-
|
|
495
|
+
requests: requests.map(request => request.action),
|
|
456
496
|
txConfig,
|
|
457
497
|
});
|
|
458
|
-
const result = await this.forwardWithPublisherRotation(
|
|
498
|
+
const result = await this.forwardWithPublisherRotation(requests, txConfig, blobConfig);
|
|
459
499
|
if (result === undefined) {
|
|
460
500
|
return undefined;
|
|
461
501
|
}
|
|
462
|
-
const { successfulActions = [], failedActions = [] } = this.callbackBundledTransactions(
|
|
463
|
-
|
|
502
|
+
const { successfulActions = [], failedActions = [] } = this.callbackBundledTransactions(requests, result);
|
|
503
|
+
const allFailedActions = [...failedActions, ...droppedRequests.map(d => d.request.action)];
|
|
504
|
+
return {
|
|
464
505
|
result,
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
506
|
+
expiredActions,
|
|
507
|
+
sentActions: requests.map(x => x.action),
|
|
508
|
+
successfulActions,
|
|
509
|
+
failedActions: allFailedActions,
|
|
510
|
+
};
|
|
468
511
|
} catch (err) {
|
|
469
512
|
const viemError = formatViemError(err);
|
|
470
513
|
this.log.error(`Failed to publish bundled transactions`, viemError);
|
|
@@ -481,6 +524,40 @@ export class SequencerPublisher {
|
|
|
481
524
|
}
|
|
482
525
|
}
|
|
483
526
|
|
|
527
|
+
/** Logs entries dropped by bundle simulation as warnings on the publisher's logger. */
|
|
528
|
+
private logDroppedInSim(dropped: DroppedRequest[]): void {
|
|
529
|
+
for (const drop of dropped) {
|
|
530
|
+
const revertReasonDecoded = drop.revertReason ?? tryDecodeRevertReason(drop.returnData, this.revertDecoderAbi);
|
|
531
|
+
this.log.warn('Bundle entry dropped: action reverted in sim', {
|
|
532
|
+
action: drop.request.action,
|
|
533
|
+
revertReason: revertReasonDecoded ?? drop.returnData,
|
|
534
|
+
revertReasonDecoded,
|
|
535
|
+
returnData: drop.returnData,
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/** Backs up entries dropped by bundle simulation, one record per dropped action. */
|
|
541
|
+
private async backupDroppedInSim(dropped: DroppedRequest[]): Promise<void> {
|
|
542
|
+
if (dropped.length === 0) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
546
|
+
for (const { request: req } of dropped) {
|
|
547
|
+
this.backupFailedTx({
|
|
548
|
+
id: keccak256(req.request.data!),
|
|
549
|
+
failureType: 'simulation',
|
|
550
|
+
request: { to: req.request.to! as Hex, data: req.request.data! },
|
|
551
|
+
l1BlockNumber: l1BlockNumber.toString(),
|
|
552
|
+
error: { message: 'Bundle entry dropped: action reverted in sim' },
|
|
553
|
+
context: {
|
|
554
|
+
actions: [req.action],
|
|
555
|
+
sender: this.getSenderAddress().toString(),
|
|
556
|
+
},
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
484
561
|
/**
|
|
485
562
|
* Forwards transactions via Multicall3, rotating to the next available publisher if a send
|
|
486
563
|
* failure occurs (i.e. the tx never reached the chain).
|
|
@@ -491,19 +568,30 @@ export class SequencerPublisher {
|
|
|
491
568
|
txConfig: RequestWithExpiry['gasConfig'],
|
|
492
569
|
blobConfig: L1BlobInputs | undefined,
|
|
493
570
|
) {
|
|
571
|
+
if (!txConfig?.gasLimit) {
|
|
572
|
+
throw new Error('gasLimit is required for bundled transactions');
|
|
573
|
+
}
|
|
574
|
+
const txConfigWithGasLimit = txConfig as L1TxConfig & { gasLimit: bigint };
|
|
575
|
+
|
|
494
576
|
const triedAddresses: EthAddress[] = [];
|
|
495
577
|
let currentPublisher = this.l1TxUtils;
|
|
496
578
|
|
|
497
579
|
while (true) {
|
|
580
|
+
if (txConfig.txTimeoutAt && new Date() > txConfig.txTimeoutAt) {
|
|
581
|
+
this.log.warn(`Tx timeout (${txConfig.txTimeoutAt.toISOString()}) elapsed; stopping publisher rotation`, {
|
|
582
|
+
triedAddresses: triedAddresses.map(a => a.toString()),
|
|
583
|
+
});
|
|
584
|
+
return undefined;
|
|
585
|
+
}
|
|
498
586
|
triedAddresses.push(currentPublisher.getSenderAddress());
|
|
587
|
+
|
|
499
588
|
try {
|
|
500
589
|
const result = await Multicall3.forward(
|
|
501
590
|
validRequests.map(r => r.request),
|
|
502
591
|
currentPublisher,
|
|
503
|
-
|
|
592
|
+
txConfigWithGasLimit,
|
|
504
593
|
blobConfig,
|
|
505
|
-
|
|
506
|
-
this.log,
|
|
594
|
+
{ gasLimitRequired: true },
|
|
507
595
|
);
|
|
508
596
|
this.l1TxUtils = currentPublisher;
|
|
509
597
|
return result;
|
|
@@ -511,6 +599,12 @@ export class SequencerPublisher {
|
|
|
511
599
|
if (err instanceof TimeoutError) {
|
|
512
600
|
throw err;
|
|
513
601
|
}
|
|
602
|
+
if (err instanceof MulticallForwarderRevertedError) {
|
|
603
|
+
this.log.error('Forwarder transaction reverted on-chain; not rotating publisher', err, {
|
|
604
|
+
transactionHash: err.receipt.transactionHash,
|
|
605
|
+
});
|
|
606
|
+
return undefined;
|
|
607
|
+
}
|
|
514
608
|
const viemError = formatViemError(err);
|
|
515
609
|
if (!this.getNextPublisher) {
|
|
516
610
|
this.log.error('Failed to publish bundled transactions', viemError);
|
|
@@ -522,7 +616,11 @@ export class SequencerPublisher {
|
|
|
522
616
|
);
|
|
523
617
|
const nextPublisher = await this.getNextPublisher([...triedAddresses]);
|
|
524
618
|
if (!nextPublisher) {
|
|
525
|
-
this.log.error(
|
|
619
|
+
this.log.error(
|
|
620
|
+
`All available publishers exhausted (tried ${triedAddresses.length}), failed to publish bundled transactions`,
|
|
621
|
+
viemError,
|
|
622
|
+
{ triedAddresses: triedAddresses.map(a => a.toString()) },
|
|
623
|
+
);
|
|
526
624
|
return undefined;
|
|
527
625
|
}
|
|
528
626
|
currentPublisher = nextPublisher;
|
|
@@ -530,74 +628,98 @@ export class SequencerPublisher {
|
|
|
530
628
|
}
|
|
531
629
|
}
|
|
532
630
|
|
|
631
|
+
/*
|
|
632
|
+
* Schedules sending all enqueued requests at (or after) the start of the given L2 slot.
|
|
633
|
+
*/
|
|
634
|
+
public async sendRequestsAt(targetSlot: SlotNumber): Promise<SendRequestsResult | undefined> {
|
|
635
|
+
await this.waitForTargetSlot(targetSlot);
|
|
636
|
+
if (this.interrupted) {
|
|
637
|
+
return undefined;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return this.sendRequests(targetSlot);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Sleeps until one L1 slot before the L2 slot boundary, and then waits for that L1 block
|
|
645
|
+
* to be mined, so we don't risk being included in it. If that block never gets mined after
|
|
646
|
+
* a timeout, we assume it got skipped on L1, so we send the tx anyway.
|
|
647
|
+
*/
|
|
648
|
+
private async waitForTargetSlot(targetSlot: SlotNumber): Promise<void> {
|
|
649
|
+
const l1Constants = this.epochCache.getL1Constants();
|
|
650
|
+
const nowInSeconds = this.dateProvider.nowInSeconds();
|
|
651
|
+
const startOfTargetSlotTs = getTimestampForSlot(targetSlot, l1Constants);
|
|
652
|
+
const previousL1BlockTs = startOfTargetSlotTs - this.ethereumSlotDuration;
|
|
653
|
+
const waitDeadlineTs = previousL1BlockTs + BigInt(this.previousL1BlockWaitTimeoutMs / 1000);
|
|
654
|
+
const logCtx = { targetSlot, startOfTargetSlotTs, nowInSeconds, previousL1BlockTs, waitDeadlineTs };
|
|
655
|
+
|
|
656
|
+
// Check if we are already past time
|
|
657
|
+
if (nowInSeconds >= startOfTargetSlotTs) {
|
|
658
|
+
this.log.verbose(`Target slot ${targetSlot} already started, sending requests immediately`, logCtx);
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// Otherwise we wait
|
|
663
|
+
this.log.debug(`Waiting for slot ${targetSlot} before sending requests`, logCtx);
|
|
664
|
+
|
|
665
|
+
// Wait until previous L1 block timestamp first
|
|
666
|
+
const sleepMs = (Number(previousL1BlockTs) - nowInSeconds) * 1000;
|
|
667
|
+
if (sleepMs > 0 && !this.interrupted) {
|
|
668
|
+
this.log.trace(`Sleeping ${sleepMs}ms before waiting for previous L1 block`, logCtx);
|
|
669
|
+
await this.interruptibleSleep.sleep(sleepMs);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// Then loop until we see the previous L1 block, so we know that we cannot be included in it.
|
|
673
|
+
// We time out after a while, once we are sure that that block is skipped in L1.
|
|
674
|
+
while (!this.interrupted) {
|
|
675
|
+
try {
|
|
676
|
+
const nowInSeconds = this.dateProvider.nowInSeconds();
|
|
677
|
+
logCtx.nowInSeconds = nowInSeconds;
|
|
678
|
+
|
|
679
|
+
if (nowInSeconds >= waitDeadlineTs) {
|
|
680
|
+
this.log.warn(`Timed out waiting for previous L1 block before sending requests, proceeding`, logCtx);
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
const latestBlockTs = await this.l1TxUtils.getBlock().then(b => b.timestamp);
|
|
685
|
+
if (latestBlockTs >= previousL1BlockTs) {
|
|
686
|
+
this.log.debug(`Previous L1 block mined, proceeding to send requests`, { ...logCtx, latestBlockTs });
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
this.log.trace(`Previous L1 block not mined yet, continuing to wait`, { ...logCtx, latestBlockTs });
|
|
690
|
+
} catch (err) {
|
|
691
|
+
this.log.error(`Error while waiting for previous L1 block before sending requests; retrying`, err, logCtx);
|
|
692
|
+
} finally {
|
|
693
|
+
await this.interruptibleSleep.sleep(this.previousL1BlockWaitPollIntervalMs);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
533
698
|
private callbackBundledTransactions(
|
|
534
699
|
requests: RequestWithExpiry[],
|
|
535
|
-
result: { receipt: TransactionReceipt;
|
|
536
|
-
txContext: { multicallData: Hex; blobData?: Hex[]; l1BlockNumber: bigint },
|
|
700
|
+
result: { receipt: TransactionReceipt; multicallData: Hex },
|
|
537
701
|
) {
|
|
538
702
|
const actionsListStr = requests.map(r => r.action).join(', ');
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
this.log.verbose(`Published bundled transactions (${actionsListStr})`, {
|
|
557
|
-
result,
|
|
558
|
-
requests: requests.map(r => ({
|
|
559
|
-
...r,
|
|
560
|
-
// Avoid logging large blob data
|
|
561
|
-
blobConfig: r.blobConfig
|
|
562
|
-
? { ...r.blobConfig, blobs: r.blobConfig.blobs.map(b => ({ size: trimmedBytesLength(b) })) }
|
|
563
|
-
: undefined,
|
|
564
|
-
})),
|
|
565
|
-
});
|
|
566
|
-
const successfulActions: Action[] = [];
|
|
567
|
-
const failedActions: Action[] = [];
|
|
568
|
-
for (const request of requests) {
|
|
569
|
-
if (request.checkSuccess(request.request, result)) {
|
|
570
|
-
successfulActions.push(request.action);
|
|
571
|
-
} else {
|
|
572
|
-
failedActions.push(request.action);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
// Single backup for the whole reverted tx
|
|
576
|
-
if (failedActions.length > 0 && result?.receipt?.status === 'reverted') {
|
|
577
|
-
this.backupFailedTx({
|
|
578
|
-
id: result.receipt.transactionHash,
|
|
579
|
-
failureType: 'revert',
|
|
580
|
-
request: { to: MULTI_CALL_3_ADDRESS, data: txContext.multicallData },
|
|
581
|
-
blobData: txContext.blobData,
|
|
582
|
-
l1BlockNumber: result.receipt.blockNumber.toString(),
|
|
583
|
-
receipt: {
|
|
584
|
-
transactionHash: result.receipt.transactionHash,
|
|
585
|
-
blockNumber: result.receipt.blockNumber.toString(),
|
|
586
|
-
gasUsed: (result.receipt.gasUsed ?? 0n).toString(),
|
|
587
|
-
status: 'reverted',
|
|
588
|
-
},
|
|
589
|
-
error: { message: result.errorMsg ?? 'Transaction reverted' },
|
|
590
|
-
context: {
|
|
591
|
-
actions: failedActions,
|
|
592
|
-
requests: requests
|
|
593
|
-
.filter(r => failedActions.includes(r.action))
|
|
594
|
-
.map(r => ({ action: r.action, to: r.request.to! as Hex, data: r.request.data! })),
|
|
595
|
-
sender: this.getSenderAddress().toString(),
|
|
596
|
-
},
|
|
597
|
-
});
|
|
703
|
+
this.log.verbose(`Published bundled transactions (${actionsListStr})`, {
|
|
704
|
+
result,
|
|
705
|
+
requests: requests.map(r => ({
|
|
706
|
+
...r,
|
|
707
|
+
// Avoid logging large blob data
|
|
708
|
+
blobConfig: r.blobConfig
|
|
709
|
+
? { ...r.blobConfig, blobs: r.blobConfig.blobs.map(b => ({ size: trimmedBytesLength(b) })) }
|
|
710
|
+
: undefined,
|
|
711
|
+
})),
|
|
712
|
+
});
|
|
713
|
+
const successfulActions: Action[] = [];
|
|
714
|
+
const failedActions: Action[] = [];
|
|
715
|
+
for (const request of requests) {
|
|
716
|
+
if (request.checkSuccess(request.request, result)) {
|
|
717
|
+
successfulActions.push(request.action);
|
|
718
|
+
} else {
|
|
719
|
+
failedActions.push(request.action);
|
|
598
720
|
}
|
|
599
|
-
return { successfulActions, failedActions };
|
|
600
721
|
}
|
|
722
|
+
return { successfulActions, failedActions };
|
|
601
723
|
}
|
|
602
724
|
|
|
603
725
|
/**
|
|
@@ -605,25 +727,27 @@ export class SequencerPublisher {
|
|
|
605
727
|
* @param tipArchive - The archive to check
|
|
606
728
|
* @returns The slot and block number if it is possible to propose, undefined otherwise
|
|
607
729
|
*/
|
|
608
|
-
public canProposeAt(
|
|
609
|
-
tipArchive: Fr,
|
|
610
|
-
msgSender: EthAddress,
|
|
611
|
-
opts: { forcePendingCheckpointNumber?: CheckpointNumber; pipelined?: boolean } = {},
|
|
612
|
-
) {
|
|
730
|
+
public async canProposeAt(tipArchive: Fr, msgSender: EthAddress, simulationOverridesPlan?: SimulationOverridesPlan) {
|
|
613
731
|
// TODO: #14291 - should loop through multiple keys to check if any of them can propose
|
|
614
|
-
|
|
732
|
+
// These errors are expected when we cannot actually propose right now — usually because our
|
|
733
|
+
// local view of the chain is ahead of L1 (proposed parent hasn't landed yet, or someone
|
|
734
|
+
// else has just landed the slot, or the archive override doesn't match). We log a warn and
|
|
735
|
+
// skip the proposal; we do NOT treat these as bugs.
|
|
736
|
+
const expectedErrors = ['SlotAlreadyInChain', 'InvalidProposer', 'InvalidArchive'];
|
|
615
737
|
|
|
616
|
-
const
|
|
617
|
-
const slotOffset = pipelined ? this.aztecSlotDuration : 0n;
|
|
738
|
+
const slotOffset = this.aztecSlotDuration;
|
|
618
739
|
const nextL1SlotTs = this.getNextL1SlotTimestamp() + slotOffset;
|
|
619
740
|
|
|
620
741
|
return this.rollupContract
|
|
621
|
-
.canProposeAt(
|
|
622
|
-
|
|
623
|
-
|
|
742
|
+
.canProposeAt(
|
|
743
|
+
tipArchive.toBuffer(),
|
|
744
|
+
msgSender.toString(),
|
|
745
|
+
nextL1SlotTs,
|
|
746
|
+
await buildSimulationOverridesStateOverride(this.rollupContract, simulationOverridesPlan),
|
|
747
|
+
)
|
|
624
748
|
.catch(err => {
|
|
625
|
-
if (err instanceof FormattedViemError &&
|
|
626
|
-
this.log.warn(`Failed canProposeAtTime check with ${
|
|
749
|
+
if (err instanceof FormattedViemError && expectedErrors.find(e => err.message.includes(e))) {
|
|
750
|
+
this.log.warn(`Failed canProposeAtTime check with ${expectedErrors.find(e => err.message.includes(e))}`, {
|
|
627
751
|
error: err.message,
|
|
628
752
|
});
|
|
629
753
|
} else {
|
|
@@ -642,13 +766,13 @@ export class SequencerPublisher {
|
|
|
642
766
|
@trackSpan('SequencerPublisher.validateBlockHeader')
|
|
643
767
|
public async validateBlockHeader(
|
|
644
768
|
header: CheckpointHeader,
|
|
645
|
-
|
|
769
|
+
simulationOverridesPlan?: SimulationOverridesPlan,
|
|
646
770
|
): Promise<void> {
|
|
647
771
|
const flags = { ignoreDA: true, ignoreSignatures: true };
|
|
648
772
|
|
|
649
773
|
const args = [
|
|
650
774
|
header.toViem(),
|
|
651
|
-
CommitteeAttestationsAndSigners.
|
|
775
|
+
CommitteeAttestationsAndSigners.packAttestations([]),
|
|
652
776
|
[], // no signers
|
|
653
777
|
Signature.empty().toViemSignature(),
|
|
654
778
|
`0x${'0'.repeat(64)}`, // 32 empty bytes
|
|
@@ -656,10 +780,9 @@ export class SequencerPublisher {
|
|
|
656
780
|
flags,
|
|
657
781
|
] as const;
|
|
658
782
|
|
|
659
|
-
const
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
);
|
|
783
|
+
const l1Constants = this.epochCache.getL1Constants();
|
|
784
|
+
const ts = getLastL1SlotTimestampForL2Slot(header.slotNumber, l1Constants);
|
|
785
|
+
const stateOverrides = await buildSimulationOverridesStateOverride(this.rollupContract, simulationOverridesPlan);
|
|
663
786
|
let balance = 0n;
|
|
664
787
|
if (this.config.fishermanMode) {
|
|
665
788
|
// In fisherman mode, we can't know where the proposer is publishing from
|
|
@@ -732,6 +855,7 @@ export class SequencerPublisher {
|
|
|
732
855
|
gasUsed,
|
|
733
856
|
checkpointNumber,
|
|
734
857
|
forcePendingCheckpointNumber: CheckpointNumber(checkpointNumber - 1),
|
|
858
|
+
lastArchive: validationResult.checkpoint.lastArchive,
|
|
735
859
|
reason,
|
|
736
860
|
};
|
|
737
861
|
} catch (err) {
|
|
@@ -744,8 +868,8 @@ export class SequencerPublisher {
|
|
|
744
868
|
`Simulation for invalidate checkpoint ${checkpointNumber} failed due to checkpoint not being in pending chain`,
|
|
745
869
|
{ ...logData, request, error: viemError.message },
|
|
746
870
|
);
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
871
|
+
const latestProposedCheckpointNumber = await this.rollupContract.getCheckpointNumber();
|
|
872
|
+
if (latestProposedCheckpointNumber < checkpointNumber) {
|
|
749
873
|
this.log.verbose(`Checkpoint ${checkpointNumber} has already been invalidated`, { ...logData });
|
|
750
874
|
return undefined;
|
|
751
875
|
} else {
|
|
@@ -790,9 +914,11 @@ export class SequencerPublisher {
|
|
|
790
914
|
const logData = { ...checkpoint, reason };
|
|
791
915
|
this.log.debug(`Building invalidate checkpoint ${checkpoint.checkpointNumber} request`, logData);
|
|
792
916
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
)
|
|
917
|
+
// Use the exact packed tuple posted to L1 verbatim. A repack via `packAttestations` is not a
|
|
918
|
+
// byte-faithful inverse of `fromPacked` (a canonicalized yParity byte or an all-zero signature slot
|
|
919
|
+
// round-trips differently), so it would diverge from the stored `attestationsHash` and revert the
|
|
920
|
+
// invalidation.
|
|
921
|
+
const attestationsAndSigners = validationResult.verbatimAttestations;
|
|
796
922
|
|
|
797
923
|
if (reason === 'invalid-attestation') {
|
|
798
924
|
return this.rollupContract.buildInvalidateBadAttestationRequest(
|
|
@@ -813,40 +939,11 @@ export class SequencerPublisher {
|
|
|
813
939
|
}
|
|
814
940
|
}
|
|
815
941
|
|
|
816
|
-
/** Simulates `propose` to make sure that the checkpoint is valid for submission */
|
|
817
|
-
@trackSpan('SequencerPublisher.validateCheckpointForSubmission')
|
|
818
|
-
public async validateCheckpointForSubmission(
|
|
819
|
-
checkpoint: Checkpoint,
|
|
820
|
-
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
821
|
-
attestationsAndSignersSignature: Signature,
|
|
822
|
-
options: { forcePendingCheckpointNumber?: CheckpointNumber },
|
|
823
|
-
): Promise<void> {
|
|
824
|
-
const blobFields = checkpoint.toBlobFields();
|
|
825
|
-
const blobs = await getBlobsPerL1Block(blobFields);
|
|
826
|
-
const blobInput = getPrefixedEthBlobCommitments(blobs);
|
|
827
|
-
|
|
828
|
-
const args = [
|
|
829
|
-
{
|
|
830
|
-
header: checkpoint.header.toViem(),
|
|
831
|
-
archive: toHex(checkpoint.archive.root.toBuffer()),
|
|
832
|
-
oracleInput: {
|
|
833
|
-
feeAssetPriceModifier: checkpoint.feeAssetPriceModifier,
|
|
834
|
-
},
|
|
835
|
-
},
|
|
836
|
-
attestationsAndSigners.getPackedAttestations(),
|
|
837
|
-
attestationsAndSigners.getSigners().map(signer => signer.toString()),
|
|
838
|
-
attestationsAndSignersSignature.toViemSignature(),
|
|
839
|
-
blobInput,
|
|
840
|
-
] as const;
|
|
841
|
-
|
|
842
|
-
await this.simulateProposeTx(args, options);
|
|
843
|
-
}
|
|
844
|
-
|
|
845
942
|
private async enqueueCastSignalHelper(
|
|
846
943
|
slotNumber: SlotNumber,
|
|
847
944
|
signalType: GovernanceSignalAction,
|
|
848
945
|
payload: EthAddress,
|
|
849
|
-
base:
|
|
946
|
+
base: GovernanceProposerContract,
|
|
850
947
|
signerAddress: EthAddress,
|
|
851
948
|
signer: (msg: TypedDataDefinition) => Promise<`0x${string}`>,
|
|
852
949
|
): Promise<boolean> {
|
|
@@ -872,34 +969,28 @@ export class SequencerPublisher {
|
|
|
872
969
|
return false;
|
|
873
970
|
}
|
|
874
971
|
|
|
875
|
-
if (await
|
|
972
|
+
if (await base.isPayloadEmpty(payload)) {
|
|
876
973
|
this.log.warn(`Skipping vote cast for payload with empty code`);
|
|
877
974
|
return false;
|
|
878
975
|
}
|
|
879
976
|
|
|
880
|
-
//
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
this.payloadProposedCache.add(cacheKey);
|
|
894
|
-
}
|
|
895
|
-
} catch (err) {
|
|
896
|
-
this.log.warn(`Failed to check if payload ${payload} was proposed after retries, skipping signal`, err);
|
|
897
|
-
return false;
|
|
898
|
-
}
|
|
977
|
+
// Skip signaling if there is already a live (non-terminal) Governance proposal for this
|
|
978
|
+
// payload. This is intentionally not cached: a previously-live proposal may transition to
|
|
979
|
+
// a terminal state (Dropped/Rejected/Expired/Executed), at which point we may want to re-signal
|
|
980
|
+
// the same payload in a future round.
|
|
981
|
+
let proposed = false;
|
|
982
|
+
try {
|
|
983
|
+
proposed = await base.hasActiveProposalWithPayload(payload.toString());
|
|
984
|
+
} catch (err) {
|
|
985
|
+
// We deliberately swallow the error and proceed to signal. Failing closed (skipping the
|
|
986
|
+
// signal) on transient RPC errors would let a flaky L1 endpoint silence governance
|
|
987
|
+
// participation entirely; failing open at worst produces a duplicate signal that the
|
|
988
|
+
// contract will simply count alongside others in the round.
|
|
989
|
+
this.log.error(`Failed to check if payload ${payload} was already proposed (signalling anyway)`, err);
|
|
899
990
|
}
|
|
900
991
|
|
|
901
|
-
if (
|
|
902
|
-
this.log.info(`Payload ${payload}
|
|
992
|
+
if (proposed) {
|
|
993
|
+
this.log.info(`Payload ${payload} has a live governance proposal, stopping signals`);
|
|
903
994
|
return false;
|
|
904
995
|
}
|
|
905
996
|
|
|
@@ -921,45 +1012,19 @@ export class SequencerPublisher {
|
|
|
921
1012
|
lastValidL2Slot: slotNumber,
|
|
922
1013
|
});
|
|
923
1014
|
|
|
924
|
-
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
925
|
-
const timestamp = this.getSimulationTimestamp(slotNumber);
|
|
926
|
-
|
|
927
|
-
try {
|
|
928
|
-
await this.l1TxUtils.simulate(request, { time: timestamp }, [], mergeAbis([request.abi ?? [], ErrorsAbi]));
|
|
929
|
-
this.log.debug(`Simulation for ${action} at slot ${slotNumber} succeeded`, { request });
|
|
930
|
-
} catch (err) {
|
|
931
|
-
const viemError = formatViemError(err);
|
|
932
|
-
this.log.error(`Failed simulation for ${action} at slot ${slotNumber} (enqueuing the action anyway)`, viemError, {
|
|
933
|
-
simulationTimestamp: timestamp,
|
|
934
|
-
l1BlockNumber,
|
|
935
|
-
});
|
|
936
|
-
this.backupFailedTx({
|
|
937
|
-
id: keccak256(request.data!),
|
|
938
|
-
failureType: 'simulation',
|
|
939
|
-
request: { to: request.to!, data: request.data!, value: request.value?.toString() },
|
|
940
|
-
l1BlockNumber: l1BlockNumber.toString(),
|
|
941
|
-
error: { message: viemError.message, name: viemError.name },
|
|
942
|
-
context: {
|
|
943
|
-
actions: [action],
|
|
944
|
-
slot: slotNumber,
|
|
945
|
-
sender: this.getSenderAddress().toString(),
|
|
946
|
-
},
|
|
947
|
-
});
|
|
948
|
-
// Yes, we enqueue the request anyway, in case there was a bug with the simulation itself
|
|
949
|
-
}
|
|
950
|
-
|
|
951
1015
|
// TODO(palla/slash): All votes (governance and slashing) should txTimeoutAt at the end of the slot.
|
|
952
1016
|
this.addRequest({
|
|
953
|
-
gasConfig: { gasLimit: SequencerPublisher.VOTE_GAS_GUESS },
|
|
954
1017
|
action,
|
|
955
1018
|
request,
|
|
956
1019
|
lastValidL2Slot: slotNumber,
|
|
957
1020
|
checkSuccess: (_request, result) => {
|
|
958
1021
|
const success =
|
|
959
1022
|
result &&
|
|
960
|
-
result.receipt
|
|
961
|
-
|
|
962
|
-
|
|
1023
|
+
extractEventSuccess(result.receipt, {
|
|
1024
|
+
address: base.address.toString(),
|
|
1025
|
+
abi: EmpireBaseAbi,
|
|
1026
|
+
eventName: 'SignalCast',
|
|
1027
|
+
});
|
|
963
1028
|
|
|
964
1029
|
const logData = { ...result, slotNumber, round, payload: payload.toString() };
|
|
965
1030
|
if (!success) {
|
|
@@ -981,17 +1046,6 @@ export class SequencerPublisher {
|
|
|
981
1046
|
return true;
|
|
982
1047
|
}
|
|
983
1048
|
|
|
984
|
-
private async isPayloadEmpty(payload: EthAddress): Promise<boolean> {
|
|
985
|
-
const key = payload.toString();
|
|
986
|
-
const cached = this.isPayloadEmptyCache.get(key);
|
|
987
|
-
if (cached) {
|
|
988
|
-
return cached;
|
|
989
|
-
}
|
|
990
|
-
const isEmpty = !(await this.l1TxUtils.getCode(payload));
|
|
991
|
-
this.isPayloadEmptyCache.set(key, isEmpty);
|
|
992
|
-
return isEmpty;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
1049
|
/**
|
|
996
1050
|
* Enqueues a governance castSignal transaction to cast a signal for a given slot number.
|
|
997
1051
|
* @param slotNumber - The slot number to cast a signal for.
|
|
@@ -1013,6 +1067,47 @@ export class SequencerPublisher {
|
|
|
1013
1067
|
);
|
|
1014
1068
|
}
|
|
1015
1069
|
|
|
1070
|
+
/**
|
|
1071
|
+
* Enqueues a `prune()` transaction if the rollup is prunable at the given slot's L1 timestamp.
|
|
1072
|
+
* `prune()` is permissionless and idempotent — if the chain is no longer prunable by send time the
|
|
1073
|
+
* bundle simulation usually drops the entry; on a node without `eth_simulateV1` the bundle is sent
|
|
1074
|
+
* as-is and the prune reverts `Rollup__NothingToPrune` inside `aggregate3(allowFailure: true)`
|
|
1075
|
+
* (a failed action, never a whole-tx revert). Used by the failed-sync fallback so a stuck pending
|
|
1076
|
+
* chain (e.g. bad data blocking sync) can be wound back to recover.
|
|
1077
|
+
* @returns true if a prune request was enqueued, false otherwise.
|
|
1078
|
+
*/
|
|
1079
|
+
public async enqueuePruneIfPrunable(slotNumber: SlotNumber): Promise<boolean> {
|
|
1080
|
+
if (this.lastActions['prune'] === slotNumber) {
|
|
1081
|
+
this.log.debug(`Skipping duplicate prune for slot ${slotNumber}`, { slotNumber });
|
|
1082
|
+
return false;
|
|
1083
|
+
}
|
|
1084
|
+
// Use the SAME timestamp the bundle simulator overrides block.timestamp with at send time
|
|
1085
|
+
// (sequencer-bundle-simulator.ts) so this upfront check and the send-time sim agree. Slot-start
|
|
1086
|
+
// and last-L1-slot both fall within the same L2 slot (and epoch, which is what `canPruneAtTime`
|
|
1087
|
+
// derives), so they agree today; matching the simulator keeps it robust if the contract ever uses
|
|
1088
|
+
// the timestamp more granularly.
|
|
1089
|
+
const ts = getLastL1SlotTimestampForL2Slot(slotNumber, this.epochCache.getL1Constants());
|
|
1090
|
+
const canPrune = await this.rollupContract.canPruneAtTime(ts).catch(err => {
|
|
1091
|
+
this.log.error(`Failed to check canPruneAtTime for slot ${slotNumber}`, err, { slotNumber });
|
|
1092
|
+
return false;
|
|
1093
|
+
});
|
|
1094
|
+
if (!canPrune) {
|
|
1095
|
+
this.log.debug(`Rollup not prunable at slot ${slotNumber}`, { slotNumber });
|
|
1096
|
+
return false;
|
|
1097
|
+
}
|
|
1098
|
+
const request: L1TxRequest = {
|
|
1099
|
+
to: this.rollupContract.address,
|
|
1100
|
+
data: encodeFunctionData({ abi: RollupAbi, functionName: 'prune', args: [] }),
|
|
1101
|
+
};
|
|
1102
|
+
this.log.info(`Enqueuing rollup prune for slot ${slotNumber}`, { slotNumber });
|
|
1103
|
+
return this.enqueueRequest(
|
|
1104
|
+
'prune',
|
|
1105
|
+
request,
|
|
1106
|
+
{ address: this.rollupContract.address, abi: RollupAbi, eventName: 'PrunedPending' },
|
|
1107
|
+
slotNumber,
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1016
1111
|
/** Enqueues all slashing actions as returned by the slasher client. */
|
|
1017
1112
|
public async enqueueSlashingActions(
|
|
1018
1113
|
actions: ProposerSlashAction[],
|
|
@@ -1027,55 +1122,6 @@ export class SequencerPublisher {
|
|
|
1027
1122
|
|
|
1028
1123
|
for (const action of actions) {
|
|
1029
1124
|
switch (action.type) {
|
|
1030
|
-
case 'vote-empire-payload': {
|
|
1031
|
-
if (this.slashingProposerContract?.type !== 'empire') {
|
|
1032
|
-
this.log.error('Cannot vote for empire payload on non-empire slashing contract');
|
|
1033
|
-
break;
|
|
1034
|
-
}
|
|
1035
|
-
this.log.debug(`Enqueuing slashing vote for payload ${action.payload} at slot ${slotNumber}`, {
|
|
1036
|
-
signerAddress,
|
|
1037
|
-
});
|
|
1038
|
-
await this.enqueueCastSignalHelper(
|
|
1039
|
-
slotNumber,
|
|
1040
|
-
'empire-slashing-signal',
|
|
1041
|
-
action.payload,
|
|
1042
|
-
this.slashingProposerContract,
|
|
1043
|
-
signerAddress,
|
|
1044
|
-
signer,
|
|
1045
|
-
);
|
|
1046
|
-
break;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
case 'create-empire-payload': {
|
|
1050
|
-
this.log.debug(`Enqueuing slashing create payload at slot ${slotNumber}`, { slotNumber, signerAddress });
|
|
1051
|
-
const request = this.slashFactoryContract.buildCreatePayloadRequest(action.data);
|
|
1052
|
-
await this.simulateAndEnqueueRequest(
|
|
1053
|
-
'create-empire-payload',
|
|
1054
|
-
request,
|
|
1055
|
-
(receipt: TransactionReceipt) =>
|
|
1056
|
-
!!this.slashFactoryContract.tryExtractSlashPayloadCreatedEvent(receipt.logs),
|
|
1057
|
-
slotNumber,
|
|
1058
|
-
);
|
|
1059
|
-
break;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
case 'execute-empire-payload': {
|
|
1063
|
-
this.log.debug(`Enqueuing slashing execute payload at slot ${slotNumber}`, { slotNumber, signerAddress });
|
|
1064
|
-
if (this.slashingProposerContract?.type !== 'empire') {
|
|
1065
|
-
this.log.error('Cannot execute slashing payload on non-empire slashing contract');
|
|
1066
|
-
return false;
|
|
1067
|
-
}
|
|
1068
|
-
const empireSlashingProposer = this.slashingProposerContract as EmpireSlashingProposerContract;
|
|
1069
|
-
const request = empireSlashingProposer.buildExecuteRoundRequest(action.round);
|
|
1070
|
-
await this.simulateAndEnqueueRequest(
|
|
1071
|
-
'execute-empire-payload',
|
|
1072
|
-
request,
|
|
1073
|
-
(receipt: TransactionReceipt) => !!empireSlashingProposer.tryExtractPayloadSubmittedEvent(receipt.logs),
|
|
1074
|
-
slotNumber,
|
|
1075
|
-
);
|
|
1076
|
-
break;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
1125
|
case 'vote-offenses': {
|
|
1080
1126
|
this.log.debug(`Enqueuing slashing vote for ${action.votes.length} votes at slot ${slotNumber}`, {
|
|
1081
1127
|
slotNumber,
|
|
@@ -1083,17 +1129,20 @@ export class SequencerPublisher {
|
|
|
1083
1129
|
votesCount: action.votes.length,
|
|
1084
1130
|
signerAddress,
|
|
1085
1131
|
});
|
|
1086
|
-
if (this.slashingProposerContract
|
|
1087
|
-
this.log.error('
|
|
1132
|
+
if (!this.slashingProposerContract) {
|
|
1133
|
+
this.log.error('No slashing proposer contract available');
|
|
1088
1134
|
return false;
|
|
1089
1135
|
}
|
|
1090
|
-
const tallySlashingProposer = this.slashingProposerContract as TallySlashingProposerContract;
|
|
1091
1136
|
const votes = bufferToHex(encodeSlashConsensusVotes(action.votes));
|
|
1092
|
-
const request = await
|
|
1093
|
-
|
|
1137
|
+
const request = await this.slashingProposerContract.buildVoteRequestFromSigner(votes, slotNumber, signer);
|
|
1138
|
+
this.enqueueRequest(
|
|
1094
1139
|
'vote-offenses',
|
|
1095
1140
|
request,
|
|
1096
|
-
|
|
1141
|
+
{
|
|
1142
|
+
address: this.slashingProposerContract.address.toString(),
|
|
1143
|
+
abi: SlashingProposerAbi,
|
|
1144
|
+
eventName: 'VoteCast',
|
|
1145
|
+
},
|
|
1097
1146
|
slotNumber,
|
|
1098
1147
|
);
|
|
1099
1148
|
break;
|
|
@@ -1105,16 +1154,22 @@ export class SequencerPublisher {
|
|
|
1105
1154
|
round: action.round,
|
|
1106
1155
|
signerAddress,
|
|
1107
1156
|
});
|
|
1108
|
-
if (this.slashingProposerContract
|
|
1109
|
-
this.log.error('
|
|
1157
|
+
if (!this.slashingProposerContract) {
|
|
1158
|
+
this.log.error('No slashing proposer contract available');
|
|
1110
1159
|
return false;
|
|
1111
1160
|
}
|
|
1112
|
-
const
|
|
1113
|
-
|
|
1114
|
-
|
|
1161
|
+
const executeRequest = this.slashingProposerContract.buildExecuteRoundRequest(
|
|
1162
|
+
action.round,
|
|
1163
|
+
action.committees,
|
|
1164
|
+
);
|
|
1165
|
+
this.enqueueRequest(
|
|
1115
1166
|
'execute-slash',
|
|
1116
|
-
|
|
1117
|
-
|
|
1167
|
+
executeRequest,
|
|
1168
|
+
{
|
|
1169
|
+
address: this.slashingProposerContract.address.toString(),
|
|
1170
|
+
abi: SlashingProposerAbi,
|
|
1171
|
+
eventName: 'RoundExecuted',
|
|
1172
|
+
},
|
|
1118
1173
|
slotNumber,
|
|
1119
1174
|
);
|
|
1120
1175
|
break;
|
|
@@ -1130,12 +1185,12 @@ export class SequencerPublisher {
|
|
|
1130
1185
|
return true;
|
|
1131
1186
|
}
|
|
1132
1187
|
|
|
1133
|
-
/**
|
|
1188
|
+
/** Enqueues a proposal for a checkpoint on L1 */
|
|
1134
1189
|
public async enqueueProposeCheckpoint(
|
|
1135
1190
|
checkpoint: Checkpoint,
|
|
1136
1191
|
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
1137
1192
|
attestationsAndSignersSignature: Signature,
|
|
1138
|
-
opts:
|
|
1193
|
+
opts: EnqueueProposeCheckpointOpts = {},
|
|
1139
1194
|
): Promise<void> {
|
|
1140
1195
|
const checkpointHeader = checkpoint.header;
|
|
1141
1196
|
|
|
@@ -1151,29 +1206,11 @@ export class SequencerPublisher {
|
|
|
1151
1206
|
feeAssetPriceModifier: checkpoint.feeAssetPriceModifier,
|
|
1152
1207
|
};
|
|
1153
1208
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
// TODO(palla): Check whether we're validating twice, once here and once within addProposeTx, since we call simulateProposeTx in both places.
|
|
1160
|
-
await this.validateCheckpointForSubmission(
|
|
1161
|
-
checkpoint,
|
|
1162
|
-
attestationsAndSigners,
|
|
1163
|
-
attestationsAndSignersSignature,
|
|
1164
|
-
opts,
|
|
1165
|
-
);
|
|
1166
|
-
} catch (err: any) {
|
|
1167
|
-
this.log.error(`Checkpoint validation failed. ${err instanceof Error ? err.message : 'No error message'}`, err, {
|
|
1168
|
-
...checkpoint.getStats(),
|
|
1169
|
-
slotNumber: checkpoint.header.slotNumber,
|
|
1170
|
-
forcePendingCheckpointNumber: opts.forcePendingCheckpointNumber,
|
|
1171
|
-
});
|
|
1172
|
-
throw err;
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
this.log.verbose(`Enqueuing checkpoint propose transaction`, { ...checkpoint.toCheckpointInfo(), ...opts });
|
|
1176
|
-
await this.addProposeTx(checkpoint, proposeTxArgs, opts);
|
|
1209
|
+
this.log.verbose(`Enqueuing checkpoint propose transaction`, {
|
|
1210
|
+
...checkpoint.toCheckpointInfo(),
|
|
1211
|
+
txTimeoutAt: opts.txTimeoutAt,
|
|
1212
|
+
});
|
|
1213
|
+
await this.addProposeTx(checkpoint, proposeTxArgs, { txTimeoutAt: opts.txTimeoutAt });
|
|
1177
1214
|
}
|
|
1178
1215
|
|
|
1179
1216
|
public enqueueInvalidateCheckpoint(
|
|
@@ -1184,23 +1221,22 @@ export class SequencerPublisher {
|
|
|
1184
1221
|
return;
|
|
1185
1222
|
}
|
|
1186
1223
|
|
|
1187
|
-
// We issued the simulation against the rollup contract, so we need to account for the overhead of the multicall3
|
|
1188
|
-
const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil((Number(request.gasUsed) * 64) / 63)));
|
|
1189
|
-
|
|
1190
1224
|
const { gasUsed, checkpointNumber } = request;
|
|
1191
|
-
const logData = { gasUsed, checkpointNumber,
|
|
1225
|
+
const logData = { gasUsed, checkpointNumber, opts };
|
|
1192
1226
|
this.log.verbose(`Enqueuing invalidate checkpoint request`, logData);
|
|
1193
1227
|
this.addRequest({
|
|
1194
1228
|
action: `invalidate-by-${request.reason}`,
|
|
1195
1229
|
request: request.request,
|
|
1196
|
-
gasConfig: {
|
|
1230
|
+
gasConfig: opts.txTimeoutAt ? { txTimeoutAt: opts.txTimeoutAt } : undefined,
|
|
1197
1231
|
lastValidL2Slot: SlotNumber(this.getCurrentL2Slot() + 2),
|
|
1198
1232
|
checkSuccess: (_req, result) => {
|
|
1199
1233
|
const success =
|
|
1200
1234
|
result &&
|
|
1201
|
-
result.receipt
|
|
1202
|
-
|
|
1203
|
-
|
|
1235
|
+
extractEventSuccess(result.receipt, {
|
|
1236
|
+
address: this.rollupContract.address,
|
|
1237
|
+
abi: RollupAbi,
|
|
1238
|
+
eventName: 'CheckpointInvalidated',
|
|
1239
|
+
});
|
|
1204
1240
|
if (!success) {
|
|
1205
1241
|
this.log.warn(`Invalidate checkpoint ${request.checkpointNumber} failed`, { ...result, ...logData });
|
|
1206
1242
|
} else {
|
|
@@ -1211,73 +1247,36 @@ export class SequencerPublisher {
|
|
|
1211
1247
|
});
|
|
1212
1248
|
}
|
|
1213
1249
|
|
|
1214
|
-
|
|
1250
|
+
/**
|
|
1251
|
+
* Dedup-checked enqueue helper for actions that are simulated at bundle-send time rather
|
|
1252
|
+
* than at enqueue time. Validates the (action, slot) dedup key, sets `lastActions`, and
|
|
1253
|
+
* enqueues without a gasLimit so the bundle simulate sets the only gasLimit that matters.
|
|
1254
|
+
*/
|
|
1255
|
+
private enqueueRequest(
|
|
1215
1256
|
action: Action,
|
|
1216
1257
|
request: L1TxRequest,
|
|
1217
|
-
|
|
1258
|
+
eventOpts: { address: string; abi: Abi; eventName: string },
|
|
1218
1259
|
slotNumber: SlotNumber,
|
|
1219
|
-
) {
|
|
1220
|
-
const timestamp = this.getSimulationTimestamp(slotNumber);
|
|
1221
|
-
const logData = { slotNumber, timestamp, gasLimit: undefined as bigint | undefined };
|
|
1260
|
+
): boolean {
|
|
1222
1261
|
if (this.lastActions[action] && this.lastActions[action] === slotNumber) {
|
|
1223
1262
|
this.log.debug(`Skipping duplicate action ${action} for slot ${slotNumber}`);
|
|
1224
1263
|
return false;
|
|
1225
1264
|
}
|
|
1226
|
-
|
|
1227
1265
|
const cachedLastActionSlot = this.lastActions[action];
|
|
1228
1266
|
this.lastActions[action] = slotNumber;
|
|
1229
1267
|
|
|
1230
|
-
this.log.debug(`
|
|
1231
|
-
|
|
1232
|
-
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
1233
|
-
|
|
1234
|
-
let gasUsed: bigint;
|
|
1235
|
-
const simulateAbi = mergeAbis([request.abi ?? [], ErrorsAbi]);
|
|
1236
|
-
|
|
1237
|
-
try {
|
|
1238
|
-
({ gasUsed } = await this.l1TxUtils.simulate(request, { time: timestamp }, [], simulateAbi));
|
|
1239
|
-
this.log.verbose(`Simulation for ${action} succeeded`, { ...logData, request, gasUsed });
|
|
1240
|
-
} catch (err) {
|
|
1241
|
-
const viemError = formatViemError(err, simulateAbi);
|
|
1242
|
-
this.log.error(`Simulation for ${action} at ${slotNumber} failed`, viemError, logData);
|
|
1243
|
-
|
|
1244
|
-
this.backupFailedTx({
|
|
1245
|
-
id: keccak256(request.data!),
|
|
1246
|
-
failureType: 'simulation',
|
|
1247
|
-
request: { to: request.to!, data: request.data!, value: request.value?.toString() },
|
|
1248
|
-
l1BlockNumber: l1BlockNumber.toString(),
|
|
1249
|
-
error: { message: viemError.message, name: viemError.name },
|
|
1250
|
-
context: {
|
|
1251
|
-
actions: [action],
|
|
1252
|
-
slot: slotNumber,
|
|
1253
|
-
sender: this.getSenderAddress().toString(),
|
|
1254
|
-
},
|
|
1255
|
-
});
|
|
1256
|
-
|
|
1257
|
-
return false;
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
// We issued the simulation against the rollup contract, so we need to account for the overhead of the multicall3
|
|
1261
|
-
const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil((Number(gasUsed) * 64) / 63)));
|
|
1262
|
-
logData.gasLimit = gasLimit;
|
|
1263
|
-
|
|
1264
|
-
// Store the ABI used for simulation on the request so Multicall3.forward can decode errors
|
|
1265
|
-
// when the tx is sent and a revert is diagnosed via simulation.
|
|
1266
|
-
const requestWithAbi = { ...request, abi: simulateAbi };
|
|
1267
|
-
|
|
1268
|
-
this.log.debug(`Enqueuing ${action}`, logData);
|
|
1268
|
+
this.log.debug(`Enqueuing ${action}`, { slotNumber });
|
|
1269
1269
|
this.addRequest({
|
|
1270
1270
|
action,
|
|
1271
|
-
request
|
|
1272
|
-
gasConfig: { gasLimit },
|
|
1271
|
+
request,
|
|
1273
1272
|
lastValidL2Slot: slotNumber,
|
|
1274
|
-
checkSuccess: (
|
|
1275
|
-
const success = result && result.receipt
|
|
1273
|
+
checkSuccess: (_request, result) => {
|
|
1274
|
+
const success = result && extractEventSuccess(result.receipt, eventOpts);
|
|
1276
1275
|
if (!success) {
|
|
1277
|
-
this.log.warn(`Action ${action} at ${slotNumber} failed`, { ...result,
|
|
1276
|
+
this.log.warn(`Action ${action} at ${slotNumber} failed`, { ...result, slotNumber });
|
|
1278
1277
|
this.lastActions[action] = cachedLastActionSlot;
|
|
1279
1278
|
} else {
|
|
1280
|
-
this.log.info(`Action ${action} at ${slotNumber} succeeded`, { ...result,
|
|
1279
|
+
this.log.info(`Action ${action} at ${slotNumber} succeeded`, { ...result, slotNumber });
|
|
1281
1280
|
}
|
|
1282
1281
|
return !!success;
|
|
1283
1282
|
},
|
|
@@ -1293,6 +1292,7 @@ export class SequencerPublisher {
|
|
|
1293
1292
|
*/
|
|
1294
1293
|
public interrupt() {
|
|
1295
1294
|
this.interrupted = true;
|
|
1295
|
+
this.interruptibleSleep.interrupt();
|
|
1296
1296
|
this.l1TxUtils.interrupt();
|
|
1297
1297
|
}
|
|
1298
1298
|
|
|
@@ -1302,10 +1302,7 @@ export class SequencerPublisher {
|
|
|
1302
1302
|
this.l1TxUtils.restart();
|
|
1303
1303
|
}
|
|
1304
1304
|
|
|
1305
|
-
private async prepareProposeTx(
|
|
1306
|
-
encodedData: L1ProcessArgs,
|
|
1307
|
-
options: { forcePendingCheckpointNumber?: CheckpointNumber },
|
|
1308
|
-
) {
|
|
1305
|
+
private async prepareProposeTx(encodedData: L1ProcessArgs) {
|
|
1309
1306
|
const kzg = Blob.getViemKzgInstance();
|
|
1310
1307
|
const blobInput = getPrefixedEthBlobCommitments(encodedData.blobs);
|
|
1311
1308
|
this.log.debug('Validating blob input', { blobInput });
|
|
@@ -1318,7 +1315,11 @@ export class SequencerPublisher {
|
|
|
1318
1315
|
blobEvaluationGas = BigInt(encodedData.blobs.length) * 21_000n;
|
|
1319
1316
|
this.log.debug(`Using fixed blob evaluation gas estimate in fisherman mode: ${blobEvaluationGas}`);
|
|
1320
1317
|
} else {
|
|
1321
|
-
//
|
|
1318
|
+
// We call validateBlobs via estimateGas with real blob+kzg sidecars as a consistency check
|
|
1319
|
+
// that our locally-built blob commitments match the blob data. The bundle simulate at send
|
|
1320
|
+
// time uses eth_simulateV1, which cannot carry blob inputs, so the rollup's on-chain blob
|
|
1321
|
+
// check is forced off there — making this the only pre-flight detector of a commitment/data
|
|
1322
|
+
// mismatch. The returned gas estimate is stashed on the request for the bundle path to read.
|
|
1322
1323
|
blobEvaluationGas = await this.l1TxUtils
|
|
1323
1324
|
.estimateGas(
|
|
1324
1325
|
this.getSenderAddress().toString(),
|
|
@@ -1376,131 +1377,21 @@ export class SequencerPublisher {
|
|
|
1376
1377
|
blobInput,
|
|
1377
1378
|
] as const;
|
|
1378
1379
|
|
|
1379
|
-
const
|
|
1380
|
+
const rollupData = encodeFunctionData({ abi: RollupAbi, functionName: 'propose', args });
|
|
1380
1381
|
|
|
1381
|
-
return { args, blobEvaluationGas, rollupData
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
/**
|
|
1385
|
-
* Simulates the propose tx with eth_simulateV1
|
|
1386
|
-
* @param args - The propose tx args
|
|
1387
|
-
* @returns The simulation result
|
|
1388
|
-
*/
|
|
1389
|
-
private async simulateProposeTx(
|
|
1390
|
-
args: readonly [
|
|
1391
|
-
{
|
|
1392
|
-
readonly header: ViemHeader;
|
|
1393
|
-
readonly archive: `0x${string}`;
|
|
1394
|
-
readonly oracleInput: {
|
|
1395
|
-
readonly feeAssetPriceModifier: bigint;
|
|
1396
|
-
};
|
|
1397
|
-
},
|
|
1398
|
-
ViemCommitteeAttestations,
|
|
1399
|
-
`0x${string}`[], // Signers
|
|
1400
|
-
ViemSignature,
|
|
1401
|
-
`0x${string}`,
|
|
1402
|
-
],
|
|
1403
|
-
options: { forcePendingCheckpointNumber?: CheckpointNumber },
|
|
1404
|
-
) {
|
|
1405
|
-
const rollupData = encodeFunctionData({
|
|
1406
|
-
abi: RollupAbi,
|
|
1407
|
-
functionName: 'propose',
|
|
1408
|
-
args,
|
|
1409
|
-
});
|
|
1410
|
-
|
|
1411
|
-
// override the pending checkpoint number if requested
|
|
1412
|
-
const forcePendingCheckpointNumberStateDiff = (
|
|
1413
|
-
options.forcePendingCheckpointNumber !== undefined
|
|
1414
|
-
? await this.rollupContract.makePendingCheckpointNumberOverride(options.forcePendingCheckpointNumber)
|
|
1415
|
-
: []
|
|
1416
|
-
).flatMap(override => override.stateDiff ?? []);
|
|
1417
|
-
|
|
1418
|
-
const stateOverrides: StateOverride = [
|
|
1419
|
-
{
|
|
1420
|
-
address: this.rollupContract.address,
|
|
1421
|
-
// @note we override checkBlob to false since blobs are not part simulate()
|
|
1422
|
-
stateDiff: [
|
|
1423
|
-
{ slot: toPaddedHex(RollupContract.checkBlobStorageSlot, true), value: toPaddedHex(0n, true) },
|
|
1424
|
-
...forcePendingCheckpointNumberStateDiff,
|
|
1425
|
-
],
|
|
1426
|
-
},
|
|
1427
|
-
];
|
|
1428
|
-
// In fisherman mode, simulate as the proposer but with sufficient balance
|
|
1429
|
-
if (this.proposerAddressForSimulation) {
|
|
1430
|
-
stateOverrides.push({
|
|
1431
|
-
address: this.proposerAddressForSimulation.toString(),
|
|
1432
|
-
balance: 10n * WEI_CONST * WEI_CONST, // 10 ETH
|
|
1433
|
-
});
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
const l1BlockNumber = await this.l1TxUtils.getBlockNumber();
|
|
1437
|
-
const simTs = this.getSimulationTimestamp(SlotNumber.fromBigInt(args[0].header.slotNumber));
|
|
1438
|
-
|
|
1439
|
-
const simulationResult = await this.l1TxUtils
|
|
1440
|
-
.simulate(
|
|
1441
|
-
{
|
|
1442
|
-
to: this.rollupContract.address,
|
|
1443
|
-
data: rollupData,
|
|
1444
|
-
gas: MAX_L1_TX_LIMIT,
|
|
1445
|
-
...(this.proposerAddressForSimulation && { from: this.proposerAddressForSimulation.toString() }),
|
|
1446
|
-
},
|
|
1447
|
-
{
|
|
1448
|
-
time: simTs,
|
|
1449
|
-
// @note reth should have a 30m gas limit per block but throws errors that this tx is beyond limit so we increase here
|
|
1450
|
-
gasLimit: MAX_L1_TX_LIMIT * 2n,
|
|
1451
|
-
},
|
|
1452
|
-
stateOverrides,
|
|
1453
|
-
RollupAbi,
|
|
1454
|
-
{
|
|
1455
|
-
// @note fallback gas estimate to use if the node doesn't support simulation API
|
|
1456
|
-
fallbackGasEstimate: MAX_L1_TX_LIMIT,
|
|
1457
|
-
},
|
|
1458
|
-
)
|
|
1459
|
-
.catch(err => {
|
|
1460
|
-
// In fisherman mode, we expect ValidatorSelection__MissingProposerSignature since fisherman doesn't have proposer signature
|
|
1461
|
-
const viemError = formatViemError(err);
|
|
1462
|
-
if (this.config.fishermanMode && viemError.message?.includes('ValidatorSelection__MissingProposerSignature')) {
|
|
1463
|
-
this.log.debug(`Ignoring expected ValidatorSelection__MissingProposerSignature error in fisherman mode`);
|
|
1464
|
-
// Return a minimal simulation result with the fallback gas estimate
|
|
1465
|
-
return {
|
|
1466
|
-
gasUsed: MAX_L1_TX_LIMIT,
|
|
1467
|
-
logs: [],
|
|
1468
|
-
};
|
|
1469
|
-
}
|
|
1470
|
-
this.log.error(`Failed to simulate propose tx`, viemError, { simulationTimestamp: simTs });
|
|
1471
|
-
this.backupFailedTx({
|
|
1472
|
-
id: keccak256(rollupData),
|
|
1473
|
-
failureType: 'simulation',
|
|
1474
|
-
request: { to: this.rollupContract.address, data: rollupData },
|
|
1475
|
-
l1BlockNumber: l1BlockNumber.toString(),
|
|
1476
|
-
error: { message: viemError.message, name: viemError.name },
|
|
1477
|
-
context: {
|
|
1478
|
-
actions: ['propose'],
|
|
1479
|
-
slot: Number(args[0].header.slotNumber),
|
|
1480
|
-
sender: this.getSenderAddress().toString(),
|
|
1481
|
-
},
|
|
1482
|
-
});
|
|
1483
|
-
throw err;
|
|
1484
|
-
});
|
|
1485
|
-
|
|
1486
|
-
return { rollupData, simulationResult };
|
|
1382
|
+
return { args, blobEvaluationGas, rollupData };
|
|
1487
1383
|
}
|
|
1488
1384
|
|
|
1489
1385
|
private async addProposeTx(
|
|
1490
1386
|
checkpoint: Checkpoint,
|
|
1491
1387
|
encodedData: L1ProcessArgs,
|
|
1492
|
-
opts:
|
|
1388
|
+
opts: EnqueueProposeCheckpointOpts = {},
|
|
1493
1389
|
): Promise<void> {
|
|
1494
1390
|
const slot = checkpoint.header.slotNumber;
|
|
1495
1391
|
const timer = new Timer();
|
|
1496
1392
|
const kzg = Blob.getViemKzgInstance();
|
|
1497
|
-
const { rollupData,
|
|
1393
|
+
const { rollupData, blobEvaluationGas } = await this.prepareProposeTx(encodedData);
|
|
1498
1394
|
const startBlock = await this.l1TxUtils.getBlockNumber();
|
|
1499
|
-
const gasLimit = this.l1TxUtils.bumpGasLimit(
|
|
1500
|
-
BigInt(Math.ceil((Number(simulationResult.gasUsed) * 64) / 63)) +
|
|
1501
|
-
blobEvaluationGas +
|
|
1502
|
-
SequencerPublisher.MULTICALL_OVERHEAD_GAS_GUESS, // We issue the simulation against the rollup contract, so we need to account for the overhead of the multicall3
|
|
1503
|
-
);
|
|
1504
1395
|
|
|
1505
1396
|
// Send the blobs to the blob client preemptively. This helps in tests where the sequencer mistakingly thinks that the propose
|
|
1506
1397
|
// tx fails but it does get mined. We make sure that the blobs are sent to the blob client regardless of the tx outcome.
|
|
@@ -1517,7 +1408,8 @@ export class SequencerPublisher {
|
|
|
1517
1408
|
data: rollupData,
|
|
1518
1409
|
},
|
|
1519
1410
|
lastValidL2Slot: checkpoint.header.slotNumber,
|
|
1520
|
-
gasConfig: {
|
|
1411
|
+
gasConfig: { txTimeoutAt: opts.txTimeoutAt, gasLimit: undefined },
|
|
1412
|
+
blobEvaluationGas,
|
|
1521
1413
|
blobConfig: {
|
|
1522
1414
|
blobs: encodedData.blobs.map(b => b.data),
|
|
1523
1415
|
kzg,
|
|
@@ -1527,10 +1419,11 @@ export class SequencerPublisher {
|
|
|
1527
1419
|
return false;
|
|
1528
1420
|
}
|
|
1529
1421
|
const { receipt, stats, errorMsg } = result;
|
|
1530
|
-
const success =
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1422
|
+
const success = extractEventSuccess(receipt, {
|
|
1423
|
+
address: this.rollupContract.address,
|
|
1424
|
+
abi: RollupAbi,
|
|
1425
|
+
eventName: 'CheckpointProposed',
|
|
1426
|
+
});
|
|
1534
1427
|
|
|
1535
1428
|
if (success) {
|
|
1536
1429
|
const endBlock = receipt.blockNumber;
|
|
@@ -1571,13 +1464,6 @@ export class SequencerPublisher {
|
|
|
1571
1464
|
});
|
|
1572
1465
|
}
|
|
1573
1466
|
|
|
1574
|
-
/** Returns the timestamp of the last L1 slot within a given L2 slot. Used as the simulation timestamp
|
|
1575
|
-
* for eth_simulateV1 calls, since it's guaranteed to be greater than any L1 block produced during the slot. */
|
|
1576
|
-
private getSimulationTimestamp(slot: SlotNumber): bigint {
|
|
1577
|
-
const l1Constants = this.epochCache.getL1Constants();
|
|
1578
|
-
return getLastL1SlotTimestampForL2Slot(slot, l1Constants);
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
1467
|
/** Returns the timestamp of the next L1 slot boundary after now. */
|
|
1582
1468
|
private getNextL1SlotTimestamp(): bigint {
|
|
1583
1469
|
const l1Constants = this.epochCache.getL1Constants();
|