Skip to content

Commit a719a03

Browse files
authored
fix: interrupt prover jobs in stop (#23358)
.
1 parent d33427a commit a719a03

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

yarn-project/end-to-end/src/e2e_fees/fee_settings.test.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,26 @@ describe('e2e_fees fee settings', () => {
9595
reference: reference.toInspect(),
9696
});
9797

98-
// Bump next L1 block base fee to ~3x current with a 0.1 gwei floor. The 0.1 gwei floor
98+
const minRiseTarget = (reference.feePerL2Gas * 13n) / 10n;
99+
100+
// Bump next L1 block base fee above both the current L1 fee and the L1 fee implied by
101+
// the requested L2 fee rise, with a 0.1 gwei absolute floor. The absolute floor
99102
// matters when anvil's natural EIP-1559 decay has driven `currentL1BaseFee` close to zero —
100103
// multiplying tiny numbers stays tiny, so a target below the previous oracle snapshot can
101-
// *decrease* L2 fees. The oracle rotation deadband (`LIFETIME - LAG = 3` L2 slots between
102-
// successful rotations, see FeeLib.sol:170) silently no-ops `updateL1GasFeeOracle` until
103-
// the window opens; we retry every second so the *first* call after the deadband opens
104-
// captures our bumped block.
104+
// *decrease* L2 fees. The reference-derived floor matters after an earlier spike has
105+
// already raised the L2 fee baseline: repeating the same absolute L1 base fee can leave
106+
// the derived L2 fee below the required 1.3x rise. The oracle rotation deadband
107+
// (`LIFETIME - LAG = 3` L2 slots between successful rotations, see FeeLib.sol:170)
108+
// silently no-ops `updateL1GasFeeOracle` until the window opens; we retry every second so
109+
// the *first* call after the deadband opens captures our bumped block.
105110
const latestL1Block = await cheatCodes.eth.publicClient.getBlock();
106111
const currentL1BaseFee = latestL1Block.baseFeePerGas ?? 1_000_000_000n;
107-
const targetL1BaseFee = currentL1BaseFee * 3n > 100_000_000n ? currentL1BaseFee * 3n : 100_000_000n;
112+
const referenceDerivedL1BaseFee = minRiseTarget / 8_000n;
113+
const targetL1BaseFee = [currentL1BaseFee * 2n, 100_000_000n, referenceDerivedL1BaseFee].reduce((a, b) =>
114+
a > b ? a : b,
115+
);
108116
t.logger.info(`Targeting L1 base fee ${targetL1BaseFee} (current ${currentL1BaseFee})`);
109117

110-
const minRiseTarget = (reference.feePerL2Gas * 13n) / 10n;
111-
112118
return await retryUntil(
113119
async () => {
114120
await cheatCodes.eth.setNextBlockBaseFeePerGas(targetL1BaseFee);
@@ -215,12 +221,8 @@ describe('e2e_fees fee settings', () => {
215221
const lowerMinFees = await getCurrentMinFeesAfterCheckpoint(testContractDeployBlock);
216222
// `higherMinFees` is the synthetic "stale" snapshot the wallet supposedly took before the
217223
// real L2 fee bumped — it only needs to stay above the realized `bumpedMinFees` so that
218-
// `txWithNoPadding` is still mineable after the bump. A 3x L1 spike (the magnitude
219-
// `inflateL2FeesViaL1BaseFee` produces) drives the L2 fee to roughly 2.0–2.5x of the
220-
// pre-bump baseline once EIP-1559 decay on the oracle-rotation block is accounted for,
221-
// so `2x` headroom is too tight (assertions racing against the bump landing barely above
222-
// 2x) — use `4x` for unambiguous headroom while keeping the snapshot still under the
223-
// 6x default-padding cap.
224+
// `txWithNoPadding` is still mineable after the bump. Use `4x` for unambiguous headroom
225+
// while keeping the snapshot below the 6x default-padding cap.
224226
const higherMinFees = lowerMinFees.mul(4);
225227

226228
const { txWithNoPadding, txWithDefaultPadding } = await prepareTxsWithMockedMinFees(higherMinFees, lowerMinFees);

yarn-project/prover-node/src/prover-node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
166166
async stop() {
167167
this.log.info('Stopping ProverNode');
168168
await this.epochsMonitor.stop();
169-
await this.prover.stop();
170-
await tryStop(this.publisherFactory);
171169
this.publisher?.interrupt();
172170
await Promise.all(Array.from(this.jobs.values()).map(job => job.stop()));
171+
await this.prover.stop();
172+
await tryStop(this.publisherFactory);
173173
this.rewardsMetrics.stop();
174174
this.l1Metrics.stop();
175175
await this.telemetryClient.stop();

0 commit comments

Comments
 (0)